answer.
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]
1 year 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]1 year 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
Suggest two other subtasks that may be performed in a dice game?
saul85 [17]
I do not even know wht to tell u
4 0
2 years ago
Read 2 more answers
Which of the following option is correct about HCatalog?
adell [148]

Answer:

Option (3) is the correct answer of this question.

Explanation:

  • HCatalog makes available Hive metadata to users of other Hadoop applications, such as Pig, MapReduce and Hive. it offers interfaces for MapReduce and Pig so that users can read data from and write data to the Hive warehouse.
  • This means users don't have to care about where or in what format their data is stored. So we know this way that Hcatalog makes sure our data is secure.
  • Others option does not belong to Hcatalog so these options are incorrect .

8 0
2 years ago
12) Suppose you wanted a subroutine to return to an address that was 3 bytes higher in memory than the return address currently
Snezhnost [94]

Answer:

.code

main proc

mov ecx,ebp

mov ecx, 787878

push ecx

call MySe7en

invoke ExitProcess,0

main endp

MySe7en PROC

pop ecx

sub ecx, 3

mov

push ecx

ret

end main

8 0
2 years ago
1. Do you consider Facebook, MySpace, and LinkedIn forms of disruptive or sustaining technology? Why?
Mrrafil [7]
It mainly just depends on if you "misuse" them.
8 0
2 years ago
Write a function named shout. The function should accept a string argument and display it in uppercase with an exclamation mark
Andrei [34K]

Answer:

void shout(String w) {

System.print.out(w + "!")

}

3 0
1 year ago
Other questions:
  • Refer to the exhibit. pc1 issues an arp request because it needs to send a packet to pc3. in this scenario, what will happen nex
    9·1 answer
  • If you have long column labels with columns so wide that they affect the readability of a worksheet, you should first
    7·1 answer
  • When seeking information on the internet about a variety of subjects the most useful place to look would be?
    13·2 answers
  • Raj needs to apply sorting to a current list in his Word document.
    11·2 answers
  • In this exercise, you will create a couple of helper methods for ArrayLists in a class called ArrayListMethods.
    10·1 answer
  • Consider the relation Courses(C, T, H, R, S, G), whose attributes can be thought of informally as course (C), teacher (T), hour
    10·1 answer
  • Write a program that generates 1,000 random integers between 0 and 9 and displays the count for each number. (Hint: Use a list o
    12·1 answer
  • Janeal spends her day looking at the stock and bond markets and evaluating how the portfolios of the businesses she serves will
    5·1 answer
  • Using virtualization comes with many advantages, one of them being performance. Which of these is NOT another realistic advantag
    7·1 answer
  • Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print "Too small". If greater than
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!