Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

imageimage

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Quantitative Investment Analysis

Authors: Richard A. DeFusco, Dennis W. McLeavey, Jerald E. Pinto, David E. Runkle

3rd edition

111910422X, 978-1119104544, 1119104548, 978-1119104223

More Books

Students also viewed these Programming questions

Question

How much is the deadweight loss with a price ceiling at $25

Answered: 1 week ago