Question: B. Write a method named random4DigitNum that returns an int of exactly 4 digits [1000,9999]. For example, the call of random4DigitNum() might return 1234 or

B. Write a method named random4DigitNum that returns an int of exactly 4 digits [1000,9999]. For example, the call of random4DigitNum() might return 1234 or eventually could return 9281 as both are 4 digit int's. Note that integers such as 341 and 12 as return values are not acceptable.

Reminder: You could get 20 points just for submitting the correct Class name, and correct 1,2,3 (return, name, parameters) for each method.

And here's a main() method for Chapter4.java that will work if you do this correctly:

public static void main(String[] args) {

// B. Random Four Digit Number

do {

test = random4DigitNum();

}

while (test != 1313);

System.out.println(test); // 1313

B. Write a method named random4DigitNum that returns an int of exactly }4 digits [1000,9999]. For example, the call of random4DigitNum() might return 1234

B. Write a method named random4DigitNum that returns an int of exactly 4 digits [1000,9999. For example, the call of random4Digi tNum() might return 1234 or eventually could return 9281 as both are 4 digit int's. Note that integers such as 341 and 12 as return values are not acceptable. Reminder: You could get 20 points just for submitting the correct Class name, and correct 1,2,3 (return, name, parameters) for each method. And here's a main) method for Chapter4.java that will work if you do this correctly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!