subject

You are given a program that prompts a user for 3 scores and then outputs the average of the scores. your task is to use java and modify the program as follows the program should:

read a user's first and last name
read three integer scores, calculate the total and average
determine the letter grade based on the following criteria - Average 90-100 grade is A, 80-89.99 grade is B, 70-79.99 grade is C, all others F (use a nested if)
Output formatted results consisting of the full name, the three scores, the total, average (to 2 decimal places), and the letter grade
go to step 1 if user wants to go through the above 4 steps for another student
You are required to use a method for each of the steps 1-4

you are required to use a while loop and a nested if in this program in addition to working with methods

code:

package assignment1;
import java. util. Scanner;

public class Assignment1 {

public static void main(String[] args) {
// declare scanner inputs for string and input
Scanner input = new Scanner (System. in);

//declare variables for program
String FirstName, LastName;
int score1, score2, score3;
double total, average;

//get output and input statements for first and last name
System. out. print("Please enter your first name: ");
FirstName = input. nextLine();
System. out. print("Please enter you last name: ");
LastName = input. nextLine();

//re-iterate the first and last name
System. out. print("your name is: " + FirstName + " " + LastName +
"\n\n");

//get input for test scores
System. out. print("Please enter test score 1: ");
score1 = input. nextInt();
System. out. print("Please enter test score 2: ");
score2 = input. nextInt();
System. out. print("Please enter test score 3: ");
score3 = input. nextInt();
System. out. print("\n\n");

//output 3 scores
System. out. println( FirstName + " " + LastName + "'s " + "scores are: "
+ score1 + " " + score2 + " " + score3 + "\n\n");

//set total equal to total of three scores
total = score1 + score2 + score3;

//output total scores, use printf for formatting
System. out. printf("%-10s%13.2f%n",
"the total of your 3 scores are: ", total);

//get average of test scores, use printf for formatting
average = (score1 + score2 + score3)/(3);
System. out. printf("%-10s%10.2f%n", "the average of your 3 scores are: "
, average);

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 21:00
Will this setup result in what kathy wants to print?
Answers: 2
question
Computers and Technology, 24.06.2019 02:40
Has anyone seen my grandma shes been gone for 4 years already
Answers: 1
question
Computers and Technology, 24.06.2019 16:30
What is the item which could be matched with a statement below? software installed on a computer that produces pop-up ads using your browser an example of social engineering malware loads itself before the os boot is complete type of spyware that tracks your keystrokes, including passwords windows key + l the practice of tricking people into giving out private information or allowing unsafe programs into the network or computer when someone who is unauthorized follows the employee through a secured entrance to a room or building a type of malware that tricks you into opening it by substituting itself for a legitimate program a computer that has been hacked, and the hacker is using the computer to run repetitive software in the background without the user's knowledge an infestation designed to copy itself repeatedly to memory, on drive space, or on a network
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
Jacking is a crime that takes place when a hacker misdirects url to a different site. the link itself looks safe, but the user is directed to an unsafe page
Answers: 1
You know the right answer?
You are given a program that prompts a user for 3 scores and then outputs the average of the scores....
Questions
question
Arts, 11.01.2021 09:20
question
Mathematics, 11.01.2021 09:20
question
Mathematics, 11.01.2021 09:20
Questions on the website: 13722367