Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write your code in the file LuckySevens.java. Write your test cases in assign3-t

ID: 3543937 • Letter: W

Question

Write your code in the file LuckySevens.java. Write your test cases in assign3-testcases.txt.

Sevens are considered lucky numbers. Your task is to count the number of sevens that appear within a range of numbers. Your solution should make use of looping constructs.

Ask the user for the following information, in this order:

Determine the number of sevens that appear in the sequence from lower end to upper end (inclusive).
Hint: Some numbers have more than 1 seven, and not every 7 appears in the ones place.
Hint2: Nested loops are helpful

Exit on error.

Explanation / Answer

public class LuckySevens { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("java LuckySevens, Gaohua Liu"); int count = 0; System.out.println("enter the lower end of the range "); int lower = IO.readInt(); while (lower < 0){ IO.reportBadInput(); System.out.println("try again, enter the lower end of the range (> 0) "); lower = IO.readInt(); } System.out.println("enter the upper end of the range ( >= lower number) "); int upper = IO.readInt(); while (upper