- Provided Quiz7_averageScores_00.Java Modify this program to 1. Request certain number of decimals in certain range a. the decimal is within certain range (0-100) } b. user will decide how many scores to enter 2. Calculate the average 3. Display the result in certain format import java.util.Scanner; public class Quiz7_averageScores_00 { public static void main(String[] args) { System.out.println("This is a program for Quiz7 by Li Ma.\n"); //use your name instead } int cnt=0; double v, total=0; double avg; Scanner minput = new Scanner(System.in); //Request certain number of scores //repeat requesting 5 times to get 5 scores int i=0; while (i<5) { } System.out.print("Please enter a score (0-100): "); v = minput.nextDouble(); total += v; cnt++; i++; //Calculate the average avg total/cnt; //Display the result in certain format System.out.printf("The average of entered scores is %.1f", avg);
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Can you the modifications specified in the comments to this java
We have been given a java program on which we have to provide the required modifications-
1. Request certain number of decimals in certain range a. the decimal is within certain range (0-100)
b. user will decide how many scores to enter
2. Calculate the average
3. Display the result in certain format
Step by step
Solved in 2 steps