Question
I don't really understand how to make the scores show up and how to make it start over. I honestly only half understand the things
I don't really understand how to make the scores show up and how to make it start over. I honestly only half understand the things I've used to piece this together to make this work so far. but this is what I was asked to do.....
- 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
- I am required to use a method for each of the steps 1-4, and required to use a while loop and a nested if in the program in addition to working with methods
and this is what I have so far.......
package speakmanassignment2;
import java.util.*;
public class SpeakmanAssignment2 { public static void main(String[] args) { // First & Last Names String FirstName = getFirstName(); String LastName = getLastName(); Scanner sc = new Scanner(System.in); int score[]=new int[3]; //Score input System.out.println("First Score:"); score[0]=sc.nextInt(); System.out.println("Second Score"); score[1]=sc.nextInt(); System.out.println("Third Score"); score[2]=sc.nextInt(); //Total int total= getTotal(score); //Average float average = (float)total/3; //Calculate grade char grade = getGrade(average); //Output System.out.println("Full name "+FirstName+" "+LastName); System.out.println("Score 1: %f, Score2:f, Score3:f, "); System.out.println("Total %.2f"+total); System.out.printf("Average %.2f ",average); System.out.println(" Grade "+grade); } //Return first name public static String getFirstName(){ Scanner sc = new Scanner(System.in); System.out.println("Enter First Name "); String name = sc.next(); return name; } //Return last name public static String getLastName(){ Scanner sc = new Scanner(System.in); System.out.println("Enter Last Name "); String name = sc.next(); return name; } //Return scores {
} //Return total score public static int getTotal(int a[]){ int total=0; for(int i=0;i
}
------END------
Any help with this would really be appreciated cause I'm really lost.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started