1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Olenka [21]
3 years ago
7

Program MATH_SCORES: Your math instructor gives three tests worth 50 points each. You can drop one of the test scores. The final

grade is the sum of the two best test scores. Assuming the three test scores are input from the keyboard, write an interactive program that asks the user to enter three test scores and then calculates the final letter grade using the following cut-off points. >=90 A <90, >=80 B <80, >=70 C <70, >=60 D < 60 F Input validation: Display an error message if the user enters a score greater than 50 and do not accept negative values.
Computers and Technology
1 answer:
Simora [160]3 years ago
8 0

Answer:

import java.util.Scanner;

public class num5 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       //Prompt and receive the three Scores

       int score1;

       int score2;

       int score3;

       do {

           System.out.println("Enter first Score Enter score between 1 -50");

           score1 = in.nextInt();

       } while(score1>50 || score1<0);

       do {

           System.out.println("Enter second Score.The second score must be between 1 -50");

           score2 = in.nextInt();

       } while(score2>50 || score2<0);

       do {

           System.out.println("Enter Third Score Third score must between 1 -50");

           score3 = in.nextInt();

       } while(score3>50 || score3<0);

       //Find the minimum of the three to drop

       int min, min2, max;

       if(score1<score2 && score1<score3){

           min = score1;

           min2 = score2;

           max = score3;

       }

       else if(score2 < score1 && score2<score3){

           min = score2;

           min2 = score1;

           max = score3;

       }

       else{

           min = score3;

           min2 = score1;

           max = score2;

       }

       System.out.println("your entered "+max+", "+min2+" and "+min+" the min is");

       int total = max+min2;

       System.out.println("Total of the two highest is "+total);

       //Finding the grade based on the cut-off points given

       if(total>=90){

           System.out.println("Grade is A");

       }

       else if(total>=80){

           System.out.println("Grade is B");

       }

       else if(total>=70){

           System.out.println("Grade is C");

       }

       else if(total>=60){

           System.out.println("Grade is D");

       }

       else{

           System.out.println("Grade is F");

       }

   }

}

Explanation:

  • Implemented with Java
  • Use the scanner class to receive user input
  • Use a do.....while loop to validate user input for each of the variables. A valid score must be between 0 and 50 while(score>50 || score<0);  
  • Use if and else to find the minimum of the three values and drop
  • Add the two highest numbers
  • use if/else if /else statements to print the corresponding grade
You might be interested in
Where would you go to add fractions to a document in adobe indesign
prisoha [69]

Just select the fraction text and choose Open Type > Fractions from the Character panel menu.

5 0
3 years ago
How to tell what wifi your nest camera is connected to
daser333 [38]

Answer:

On the app home screen, tap Settings .

Select Home info then Home Wi-Fi help. ​Note: If you don't find Home Wi-Fi help, you'll need to remove your camera from the app and add it back with new Wi-Fi information.

Select the camera you want to update.

Tap Start. Update settings.

6 0
3 years ago
Read 2 more answers
Why is it unlikely that you will find the ip address 192.168.250.10 on the internet?
gayaneshka [121]
That IP address is either Internal, private or reserved
5 0
4 years ago
Use-case points is a project effort estimation approach based on unique features of _______ and object orientation.
Lelechka [254]
The choices that should have been included are: 

a. functions
b. classes
c. objects
d. projects
e. use cases

Use-case points is a project effort estimation approach based on unique features of E. USE CASES and object orientation.
7 0
3 years ago
________ is a method for addressing, creating, updating, or querying relational databases.
lorasvet [3.4K]
Structured Query Language<span> (</span>SQL<span>)</span>
4 0
4 years ago
Other questions:
  • Given a floating point variable fraction, write a statement that displays the value of fraction on the screen. Do not display an
    13·1 answer
  • Easy STEAM question :)
    15·2 answers
  • Privacy a. is an absolute value so corporate interests cannot be considered when it comes to employee privacy. b. is guaranteed
    8·1 answer
  • In every programming language, when you access data stored in an array, you must use a ____ containing a value that accesses mem
    8·1 answer
  • 1. Given a sequential list with n numbers, represented in a one-dimensional array A) Write an algorithm to check if the list has
    14·1 answer
  • In which of the following mouse operations do you move the mouse until the pointer is positioned on the item of choice?
    9·1 answer
  • Anyone can give me the definition of specification ?
    10·2 answers
  • You are the administrator for a small network with several servers. There is only one printer, which is centrally located. Altho
    10·1 answer
  • The machine that stores your data and files​
    9·1 answer
  • Which arcade game, released in 1972, is considered to be the first to be commercially successful?.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!