Question: 1. (4 points; 2 points each) Suppose we have the method defined below: public static int percentOutOfRange Exclusive (Scanner keyboard, String prompt, int low,

1. (4 points; 2 points each) Suppose we have the method definedbelow: public static int percentOutOfRange Exclusive (Scanner keyboard, String prompt, int low,

1. (4 points; 2 points each) Suppose we have the method defined below: public static int percentOutOfRange Exclusive (Scanner keyboard, String prompt, int low, int high, int count) { int outOfRange int reps = 0; = 0; // Counter controlled loop while (reps < count) { // Read input System.out.println(prompt); int entry = keyboard.nextInt(); keyboard.nextLine(); // Increment outOfRange if the entry is not between low and high // exclusive if (entry low || entry > high) { outOfRange = outOfRange + 1; } reps = reps + 1; } } return (int) Math.round(outOfRange * 100.0/ count); a) Write a complete main program that calls the method above to print to the console the percent of 50 values entered at the keyboard that are not between 1 and 10 (exclusive). Because the Scanner is a parameter, it will need to be declared and constructed in the main program. Write your own prompt. b) Write a complete main program that calls the method above to print to the console the percent of 10000 values entered at the keyboard that are not between -1000 and 1000 (exclusive). Because the Scanner is a parameter, it will need to be declared and constructed in the main program. Write your own prompt. 2. (5 points; 1 point each line) In the percentOutOfRange Exclusive method from problem 1, show all identifiers that fall into each category. Some lines may be blank. Parameter(s) Arguments(s) Local variables Return type Method name

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 Programming Questions!