Tag: Port sys New returns the number of break next Test Shu
/* Do a function, I pass a number to you, you return a result to me.
* Requirements: If the number is less than 100, the actual input number is returned;
* If greater than 100 is less than 200, then return ' 100+ ';
* If greater than 200 is less than 300, return ' 200+ ';
*/
Package homework;
Import Java.util.Scanner;
public class Shuzi {
public void Shuzu () {
Scanner input = new Scanner (system.in);
System.out.println ("Please enter a number:");
int id = input.nextint ();
if (ID < 0)
SYSTEM.OUT.PRINTLN ("Your input is wrong");
while (ID < 100) {
if (ID < && ID > 0) {
SYSTEM.OUT.PRINTLN (ID);
Break
}
}
while (ID > 100) {
int n1 = id/100;
if (ID > (n1 *) && ID < ((n1 + 1) * 100)) {
System.out.println ((+N1) * 100 + "+");
Break
}
}
}
public static void Main (string[] args) {
Shuzi test = new Shuzi ();
Test.shuzu ();
}
}
Enter 12 to run the result:
Please enter a number:1212
Enter 230 to run the result:
Please enter a number:230200+
Input-2, run the result:
Please enter a number:-2 Your input is wrong
Design a method and enter a number to return a result