Question: Your second program will require you to use static methods to accomplish each of the following requirements for your program. Use a while loop to

Your second program will require you to use static methods to accomplish each of the following requirements for your program. Use a while loop to ensure one or more students grades may be processed and output

  1. read a user's first and last name (you must call this method twice. First for the first name, then a second time for the last name)
  2. read three integer scores (must call the method three times, once for each of the scores)
  3. calculate the total (value returning method)
  4. calculate average (value returning method)
  5. 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 in a value returning method)
  6. output formatted results using printf method. Output must include the full name, the three scores, total, average (to 2 decimal places), and the letter grade (void method)

Go to step 1 if user wants to go through the above 6 steps for another student

You are required to use a static method for each of the steps 1-6 with the first two methods called several times .

Method main should have variable declarations and a while loop with calls to these methods. The first two methods will be called multiple times

This program DOES NOT involve creating a class which was covered in chapter 3. Your second program will require you to use static methods to accomplish

each of the following requirements for your program. Use a while loop

package methodstest; import java.util.Scanner; public class Methods Test { public static void main(String[] args) { //call the void method without parameters headerMethod(); //standalone statement String firstName, lastName; String prompt1="Please enter your first name: String prompt2="Please enter your last name: //firstName = nameMethod(); //value returning without parameters //System.out.println("You entered "+firstName); //start while loop here int flag=0; Scanner input = new Scanner(System.in); //scope of input is just the method dot firstName = nameMethod (prompt1); //value returning with parameters System.out.println("You entered "+firstName); lastName = nameMethod (prompt2); //value returning with parameters System.out.println("You entered "+lastName); //call method three times to read the scores //call method to calculate the total points / /call method to determine the average //call method to determine the letter grade outputMethod (firstName, lastName); //void method with parameters //end my while loop here System.out.print("Please enter i for another student or 0 to quit: "); flag = input.nextInt(); } while (flag!=0); System.out.println("Thank you!!!"); }//end of main //*** //example of a void method without parameters public static void headerMethod() { System.out.println(" ******"); System.out.println("IT205 Intro to Ojbect Oriented Programming"); System.out.println("Programmer: Vijay Kalburgi"); System.out.println("Date: February 22, 2021"); System.out.println(" "); }//end of headerMethod //***** //example of a value returning method without parameters. //Then changed to method with parameter public static String nameMethod (String prompt) { Scanner input = new Scanner(System.in); String name; //System.out.print("Please enter your first name: "); System.out.print (prompt); name = input.next(); return name; //since this is a value returning method and return type is String }//end of nameMethod //***** //example of a void method with parameters. public static void outputMethod (String firstName, String lastName) { System.out.println("**** *****"); System.out.println("1234567890123456789012345678901234567890"); System.out.printf ("9-2033153%n", "Full Name:", firstName+" "+lastName); System.out.println("**** "); }//end of outputMethod end of class MethodsTest

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!