Question: Write your code in the file LuckyNines.java . Use the IO module for all inputs and outputs. Your task is to write a method called
Write your code in the file LuckyNines.java. Use the IO module for all inputs and outputs. Your task is to write a method called
public static int countLuckyNines(int lowerEnd, int upperEnd)
which counts and returns the number of nines that appear within a range of numbers. Your solution should make use of looping constructs.
In main method, ask the user for the following information, in this order:
The lower end of the range
The upper end of the range
Then call countLuckyNines(lowerEnd, upperEnd) with the user input values; countLuckyNines(lowerEnd, upperEnd) returns the number of nines that appear in the sequence from lower end to upper end (inclusive). Hint: Some numbers have more than 1 nine, and not every 9 appears in the ones place. Hint2: Nested loops are helpful
must use IO.read[data type]
you must use IO.output[data type]
you must use IO.output[data type]Answer()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
