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
solong [7]
4 years ago
9

Write a program that determines a student's letter grade. Allow the user to enter three test scores. The maximum score on each t

est is 100 points. Determine the letter grade from the average of the test scores, using the following: 90% or more A 80% or more, but less than 90% B 70% or more, but less than 80% C 60% or more, but less than 70% D or F, to be determined from additional information less than 60% F Only if the grade needs to be determined between D and F, allow the user to enter the number of homework assignments the student turned in, and the total number of homework assignments. If more than 80% of the homework assignments were turned in, the letter grade is D, otherwise F. Test it 4 times: 96 84 90 95 83 90 70 59 60 with 5 homework out of 6 turned in 73 58 65 with 8 homework out of 11 turned in Compute the results by hand and check your results.
Computers and Technology
1 answer:
Elina [12.6K]4 years ago
6 0

Answer:

public class Grade {

   

   public static void main (String [] args) {

       

       int sum = 0, avg = 0;

       char grade = 'x';

       Scanner input = new Scanner(System.in);

       

       System.out.print("Enter the test scores: ");

       for(int i=1; i<=3; i++) {

           int testScore = input.nextInt();

           sum += testScore;

       }

       

       avg = sum/3;

       

       if(avg >= 90) {

          grade = 'A';

       }

       else if(avg>= 80 && avg < 90) {

          grade = 'B';

       }

       else if(avg>= 70 && avg < 80) {

          grade = 'C';

       }

       else if(avg>= 60 && avg < 70) {

         

          System.out.print("Enter the number of homeworks turned in: ");

          int homeworksTurnedIn = input.nextInt();

          System.out.print("Enter the total number of homeworks: ");

          int totalHomeworks = input.nextInt();

         

          if((homeworksTurnedIn / (double)totalHomeworks) > 0.8) {

              grade = 'D';

          }

          else

              grade = 'F';

       }

       else if(avg < 60) {

          grade = 'F';

       }

       

       System.out.println("Your grade is: " + grade);

   }

}

Explanation:

- Initialize the variables

- Ask the user for the test scores

- Inside the for loop, calculate the <em>sum</em> of the test scores

- Then, find the <em>average</em> of the scores

- Depending on the <em>average</em>, print the <em>grade</em>

You might be interested in
Who gets the reply when you use the reply all feature in a mail program?
galben [10]

Answer:

a

Explanation:

3 0
4 years ago
It means fruit- trees garden.
Vikentia [17]

Answer:

What does?

Explanation:

Do you have a question?

4 0
3 years ago
What is the code i need to do
Greeley [361]
What section is it? I did the same thing a bit ago on edhesive
3 0
3 years ago
Which operating system introduced new features such as virtual memory and
EleoNora [17]

it was a Macintosh which was released by Apple may 13th 1991.

6 0
3 years ago
Suzanne has inserted an image into her document and would like to adjust the color and contrast of the image.
ch4aika [34]

Answer: I believe it is the second one or third one

Explanation:

8 0
4 years ago
Other questions:
  • Explain how do we combine multiple Boolean values?​
    5·1 answer
  • A computer with a domain name is called a
    8·2 answers
  • A single point of failure is a piece of hardware or application that is key to ________________________.
    8·1 answer
  • Rich Text Format (RTF) is a universal file format that can include information such as text style, size, and color and can be re
    12·2 answers
  • Assume that PrecinctReport is a structured type with these fields, address (a string), and three int fields which are counts of
    9·1 answer
  • Suppose the following groups are defined to shorten a system’s access control lists: – Group1: Alice, Bob, Cynthia, David, Eve –
    12·1 answer
  • Since we know that this particular instance of the AppMaker implements a customer-facing store that processes financial transact
    6·1 answer
  • A _____ is relatively inexpensive to install and is well-suited to workgroups and users who are not anchored to a specific desk
    14·1 answer
  • How do i delete peoples comments
    14·2 answers
  • What are the steps in preparing a bootable USB installer?​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!