Does this code meet the standards set forth?

Hey guys,

This is my answer to a homework problem and i have the program working but i want to make sure you agree that it meets the functionality because its worded funky.

Any input is apprciaited

Problem: Write a method named multiple that determines, for a pair of integers, whether the second integer is a multiple of the first. The method should take two integer arguments and return true if the second is a multiple of the first and false otherwise. [Hint: Use the remainder operator.] The main () method in the test driver should read two integers, call multiple to determine if one is a multiple of the other, and print a message – i.e. as in:

The number 4 is a multiple of the number 2

or

The number 5 is not a multiple of 2

There is no need to create two classes – simply the test driver.

Code :

import java.util.Scanner; //Allows me get values from users.
public class multiples
{
public static void main(String[] args)
{
//Initializes Scanner for use
Scanner input=new Scanner(System.in);
//Declaring the Variables I will use.
int FirstNumber;
int SecondNumber;
boolean isamultiple;
System.out.println("Please Enter First Integer: \n");
FirstNumber = input.nextInt();
System.out.println("\nPlease Enter Second Interger: \n");
SecondNumber=input.nextInt();
isamultiple=testmultiple(FirstNumber,SecondNumber);
if (isamultiple)
System.out.printf("\nThe number %s is a multiple of the number %s",FirstNumber, SecondNumber);
else
System.out.printf("\nThe Number %s is not a multiple of the number %s", FirstNumber,SecondNumber);
System.exit(0);
}
public static boolean testmultiple(int Number1, int Number2)
{
if (Number1%Number2 == 0)
return true;
else
return false;

Re: Does this code meet the standards set forth?

Quote:

Originally Posted by

**Java Student**
Write a method named multiple

You haven't done that.

Quote:

whether the second integer is a multiple of the first.

You have done the opposite.

Re: Does this code meet the standards set forth?

1. Incomplete code.

Quote:

You haven't done that.

He did but with other name testmultiple, so standard is not met here

They want you to implement multiple, not testmultiple.

Re: Does this code meet the standards set forth?

Do you think I'm stupid? The whole point of my post was to highlight the incorrect name.