Write a program that asks the user to input an integer n


Assignment

Program 1

A local school system must report average weekly attendance percentages to the state on each Friday afternoon. Your task is to write a program that takes multiple school's attendance numbers for a week and computes the information needed for the report to the state.

Your program should first ask the user how many schools there are in the district. The program should then ask the user to enter each day's attendance numbers for each school for the week as well as the number of students enrolled in that school. The program should output the average attendance for the week for each school as well as the average percentage of students present that week. You must use nested FOR loops to collect the attendance input from the user. You are NOT allowed to use an array for any purpose in your program.

All console output should have meaningful descriptions. While you can't yet recover from errors generated by users entering character data for input, make sure you validate numbers entered by the user are within appropriate numeric ranges for correct input to the program. For example, the program wouldn't do anything if there were 0 schools entered. There are other cases to figure out on your own.

Program 1 sample execution & output (user input shown in bold):

How many schools do you have in your district: 2

Enter data for school 1
How many students are enrolled in school 1: 580
Enter the attendance for day 1: 502
Enter the attendance for day 2: 521
Enter the attendance for day 3: 550
Enter the attendance for day 4: 555
Enter the attendance for day 5: 568

School 1 had an average attendance of 539 students which means there were 92.93% of all students present

Enter data for school 2

How many students are enrolled in school 1: 350
Enter the attendance for day 1: 302
Enter the attendance for day 2: 332
Enter the attendance for day 3: 350
Enter the attendance for day 4: 325
Enter the attendance for day 5: 338

School 2 had an average attendance of 329 students which means there were 94% of all students present

School 2 had the best attendance this week with 94% attendance.

Program 2

Write a program that asks the user to input an integer, n. Use the value of n to set the size of the triangles to be printed by your program to the console as shown below.

If 6 was entered by the user as n, the first triangle printed by your program would look like this.
@
@@
@@@
@@@@
@@@@@
@@@@@@

Then, the 2nd triangle printed by your program would look like this.:

              @
           @@
        @@@
      @@@@
   @@@@@
@@@@@@

The triangles should notbe produced by 6 println statements, but rather byFOR loops and no more than threeprintln or print statements in each set of loops to produce each triangle. Furthermore, a single println or print statement cannot contain more than one @ symbol in its output. (hint - use a set of nested FOR loops for each triangle to control how many times the print statements execute.) Also, just like in program 1, you may not use an array for any purpose in this program.

You should print a single blank line after the first triangle so there is space between the two triangles in your console output.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write a program that asks the user to input an integer n
Reference No:- TGS02711058

Expected delivery within 24 Hours