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
Alexxandr [17]
3 years ago
13

Write the class "Tests". Ensure that it stores a student’s first name, last name, all five test scores, the average of those 5 t

ests’ scores and their final letter grade. (Use an array to store all test scores.)
Computers and Technology
1 answer:
zhannawk [14.2K]3 years ago
7 0

Answer:

The following assumption will be made for this assignment;

  • If average score is greater than 75, the letter grade is A
  • If average score is between 66 and 75, the letter grade is B
  • If average score is between 56 and 65, the letter grade is C
  • If average score is between 46 and 55, the letter grade is D
  • If average score is between 40 and 45, the letter grade is E
  • If average score is lesser than 40, the letter grade is F

The program is written in Java and it uses comments to explain difficult lines. The program is as follows

import java.util.*;

public class Tests

{

public static void main(String [] args)

{

 //Declare variables

 Scanner input = new Scanner(System.in);

 String firstname, lastname;

 //Prompt user for name

 System.out.print("Enter Lastname: ");

 lastname = input.next();

 System.out.print("Enter Firstname: ");

 firstname = input.next();

 char grade;

 //Declare Array

 int[] Scores = new int[5];

 //Initialize total scores to 0

 int total = 0;  

  //Decalare Average

  double   average;

 //Prompt user for scores

 for(int i =0;i<5;i++)

 {

  System.out.print("Enter Score "+(i+1)+": ");

  Scores[i] = input.nextInt();

  //Calculate Total Scores

  total+=Scores[i];

 }

 //Calculate Average

 average = total/5.0;

 //Get Letter Grade

 if(average>75)

 {

 grade = 'A';

 }

 else if(average>65)

 {

 grade = 'B';

 }

 else if(average>55)

 {

 grade = 'C';

 }

 else if(average>45)

 {

 grade = 'D';

 }

 else if(average>40)

 {

 grade = 'E';

 }

 else

 {

 grade = 'F';

 }

 //Print Student Results

 System.out.print("Fullname: "+lastname+", "+firstname);

 System.out.print('\n');

 System.out.print("Total Scores: "+total);

 System.out.print('\n');

 System.out.print("Average Scores: "+average);

 System.out.print('\n');

 System.out.print("Grade: "+grade);

}

}

See Attachment for .java file

Download java
You might be interested in
Which type of data is most sensitive and should be protected from malware?
Dennis_Churaev [7]
The correct answer is “C. The credit card number that you use to make an online purchase”
5 0
1 year ago
When you move into a new home or apartment, the first thing on your checklist should be to have the ____________ changed. (5 Let
Lynna [10]

Answer:

When you move into a new home or apartment, the first thing on your checklist should be to have the <u>locks</u> changed

Explanation:

Changing the locks

Given that the way the previous owners of the new home or apartment made use of the locks and the keys are usually not completely known to the new owners, one may never know all those that have a key or a means to gain access into the apartment or home. Therefore, in order to guarantee proper security, it is a good practice to have as one of the first thing on the checklist, the changing of the locks of the entrance doors and windows of the new home or apartment.

5 0
2 years ago
In linux, a(n) ____ is a data structure that stores all information (such as file permissions, ownership, and file type) about a
Galina-37 [17]
Hi,


Answer => <span>Inode


Good Lessons </span>
4 0
3 years ago
A common use-case for dictionaries is to store word counts. Let's modify our program below to store the count for each unique wo
baherus [9]

Answer:

word_count={}

for i in text.split:

        if i in word_count:

                word_count[i]+=1

         else:

                 word_count[i]=1

print word_count

8 0
3 years ago
To use patterns and observations to say what happens next
posledela
You would need to show a pic
4 0
3 years ago
Other questions:
  • Which one of the following oscilloscope controls is used to move the trace up and down the screen vertically
    14·1 answer
  • Why is it important to verify a customer complaint?
    6·1 answer
  • C - Language Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. E
    12·1 answer
  • Why do most laptops have LCD rather than OLED displays, which are found on mobile devices?
    14·1 answer
  • In what way do networks help to protect data
    6·1 answer
  • Which is the OS that can be obtained for free or at a much lower price than other major operating systems?
    15·2 answers
  • A rectangle indicates a single process.true or false​
    7·2 answers
  • If you're a beginner to data analysis, what is the first thing you should check when you build data queries?
    11·1 answer
  • What are basic types of touch screen
    15·2 answers
  • Drag the tiles to the boxes to form correct palrs.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!