Question

Code in Java SAMPLE PROGRAM OUTPUT Because there are several different things your program might do...

Code in Java

SAMPLE PROGRAM OUTPUT

Because there are several different things your program might do depending upon what the user enters, please refer to the examples below to use to test your program. Run your final program one time for each scenario to make sure that you get the expected output.

Be sure to format the output of your program so that it follows what is included in the examples. Remember, in all examples bold items are entered by the user when the program runs (and therefore can change each time the program runs).

Scenario 1: User creates a new empty student account and manipulates the new account

STUDENT PROCESSING MENU

1. Create new Student – empty Account

2. Create new Student – information available

3. Set Student First Name:

4. Set Student Last Name:

5. Enter Quiz1 Score:

6. Enter Quiz2 Score:

7. Enter Quiz3 Score:

8. Get Quiz Average

9. Get Student Id

10. Get Next Available Id

11. Compute Student Grade

12. Print Student Information

13. Exit

Please enter your preferred option: 1

Student successfully created.

StudentId #1001

Please enter your preferred option: 3

Please enter Student First Name: Kyle

Please enter your preferred option: 4

Please enter Student First Name: Potter

Please enter your preferred option: 5

Enter Quiz1 Score: 100

Please enter your preferred option: 6

Enter Quiz2 Score: 99

Please enter your preferred option: 7

Enter Quiz3 Score: 99

Please enter your preferred option: 8

Quiz Average: 99.33333333333333

Please enter your preferred option: 9

Student Id: #1001

Please enter your preferred option: 10

Next Student Id: #1002

Please enter your preferred option: 11

Student Grade: A

Please enter your preferred option: 12

Student Account Information:

StudentId: #1001

Quiz Score1: 100

Quiz Score2: 99

Quiz Score3: 99

Quiz Average: 99.33333333333333

Student Grade: A

Student Full name: Ricky Bobby

Please enter your preferred option: 13

Program Exited

Scenario 2: User creates a student account with known information and manipulates the new account

STUDENT PROCESSING MENU

1. Create new Student – empty Account

2. Create new Student – information available

3. Set Student First Name:

4. Set Student Last Name:

5. Enter Quiz1 Score:

6. Enter Quiz2 Score:

7. Enter Quiz3 Score:

8. Get Quiz Average

9. Get Student Id

10. Get Next Available Id

11. Get Student Letter Grade

12. Print Student Information

13. Exit

Please enter your preferred option: 2

Please enter Student First Name: John

Please enter Student Last Name: Doe

Enter Quiz1 Score: 90

Enter Quiz2 Score: 85

Enter Quiz3 Score: 60

Student successfully created.

StudentId #1001

Please enter your preferred option: 12

Student Account Information:

StudentId: #1001

Quiz Score1: 90

Quiz Score2: 85

Quiz Score3: 60

Quiz Average: 78.33333333333333

Student Grade C+

Student Full name: John Doe

Please enter your preferred option: 5

Enter Quiz1 Score: 100

Please enter your preferred option: 6

Enter Quiz2 Score: 99

Please enter your preferred option: 7

Enter Quiz3 Score: 100

Please enter your preferred option: 8

Quiz Average: 99.66666666666667

Please enter your preferred option: 11

Student Grade: A

Please enter your preferred option: 12

Student Account Information:

StudentId: #1001

Quiz Score1: 100

Quiz Score2: 99

Quiz Score3: 100

Quiz Average: 99.66666666666667

Student Grade: A

Student Full name: John Doe

Please enter your preferred option: 10

Student Id: #1002

Please enter your preferred option: 13

Program Exited

------------------------------------------------------------------------------------------------------------------------------

Grading Rubric

Coding standards Comments:

- Include comments before each statement of logic

- Include comments for every closing brace - }

Class Names:

- Use meaningful class names (e.g. ConvertLength, not ClassA)

- Capitalize the first letter of each word

Constants:

- Use capital letters

- Separate words with ‘_’

- No data type characters preceding constant name

Variables:

- Declare one variable per line

- Comment each variable to explain what information is stored

- Use meaningful variable names (e.g. nCount, not n)

- Initialize variables when declared

- Capitalize the first letter of each word

- The name of each variable should start with a letter to indicate the data type

Control Structures:

- Statements enclosed within a compound statement are indented one level from the enclosing braces

- Each new level of logic is indented (usually a tab, or 4-5 spaces) from the preceding level

- Braces enclose the contents of all logic constructs, and the closing brace is followed by a comment

- Each else statement is on a separate line and vertically aligned with the corresponding

if

Methods:

- Method definitions should be declared after the main method or after class constructors

- Value-returning methods should have one and only one return statement, and it should be the last statement of the method before the closing curly brace }

Method names:

- Should help describe what the method does

- Should not start with the data type letters (like variables)

- The first “word” in the method should be all lower case letters. Additional words should start with a capital letter 2

Logic

- Program works correctly for both scenarios

- Output formatted according to sample output

- Appropriate and correct definition and use of the Student class

- default constructor used with option #1

- overloaded constructor used with option #2

- Student object used with all other options

- Menu logic and processing contained in main method

- Appropriate and accurate use of { } to create compound statements for if/else and loop structures

- Calculations stored in variables – NOT calculated directly in System.out.println

statements

- Output prints values from variables, not hard-coded values (e.g. “0”)

- Only include import statements required for constructs used in source code

- Appropriate data types used for each variable and constant

- Appropriate use of constants

Homework Answers

Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
=================================

// Student.java

public class Student {
   private static int val = 1000;
   private int id;
   private String firstname;
   private String lastname;

   private int quiz1;
   private int quiz2;
   private int quiz3;

   public Student() {
       System.out.println("Student Successfully Created.");
       val++;
       this.id = val;
       this.firstname = "";
       this.lastname = "";

       this.quiz1 = 0;
       this.quiz2 = 0;
       this.quiz3 = 0;
   }

   /**
   * @param id
   * @param name
   * @param quiz1
   * @param quiz2
   * @param quiz3
   */
   public Student(String fname, String lname, int quiz1, int quiz2, int quiz3) {
       System.out.println("Student Successfully Created.");
       val++;
       this.id = val;
       this.firstname = fname;
       this.lastname = lname;
       this.quiz1 = quiz1;
       this.quiz2 = quiz2;
       this.quiz3 = quiz3;
   }

   /**
   * @return the id
   */
   public int getId() {
       return id;
   }

   /**
   * @return the firstname
   */
   public String getFirstname() {
       return firstname;
   }

   /**
   * @param firstname
   * the firstname to set
   */
   public void setFirstname(String firstname) {
       this.firstname = firstname;
   }

   /**
   * @return the lastname
   */
   public String getLastname() {
       return lastname;
   }

   /**
   * @param lastname
   * the lastname to set
   */
   public void setLastname(String lastname) {
       this.lastname = lastname;
   }

   /**
   * @return the quiz1
   */
   public int getQuiz1() {
       return quiz1;
   }

   /**
   * @param quiz1
   * the quiz1 to set
   */
   public void setQuiz1(int quiz1) {
       this.quiz1 = quiz1;
   }

   /**
   * @return the quiz2
   */
   public int getQuiz2() {
       return quiz2;
   }

   /**
   * @param quiz2
   * the quiz2 to set
   */
   public void setQuiz2(int quiz2) {
       this.quiz2 = quiz2;
   }

   /**
   * @return the quiz3
   */
   public int getQuiz3() {
       return quiz3;
   }

   /**
   * @param quiz3
   * the quiz3 to set
   */
   public void setQuiz3(int quiz3) {
       this.quiz3 = quiz3;
   }

   public double averageQuiz() {
       return (quiz1 + quiz2 + quiz3) / 3.0;
   }

   public String gradeLetter() {

       String outputGrade;
       double grade = averageQuiz();

       if (grade >= 92 && grade <= 100)
           outputGrade = "A";
       else if (grade >= 90 && grade <= 92)
           outputGrade = "A-";
       else if (grade >= 87 && grade <= 89)
           outputGrade = "B+";
       else if (grade >= 83 && grade <= 86)
           outputGrade = "B";
       else if (grade >= 80 && grade <= 82)
           outputGrade = "B-";
       else if (grade >= 77 && grade <= 79)
           outputGrade = "C+";
       else if (grade >= 70 && grade <= 76)
           outputGrade = "C";
       else if (grade >= 67 && grade <= 69)
           outputGrade = "D+";
       else if (grade >= 63 && grade <= 66)
           outputGrade = "D";
       else if (grade >= 60 && grade <= 62)
           outputGrade = "D-";
       else
           outputGrade = "F";

       return outputGrade;

   }

   /*
   * (non-Javadoc)
   *
   * @see java.lang.Object#toString()
   */
   @Override
   public String toString() {
       String s = "StudentId: #" + getId() + "\nQuiz Score1: " + quiz1
               + "\nQuiz Score2: " + quiz2 + "\nQuiz Score3: " + quiz3
               + "\nQuiz Average: " + averageQuiz() + "\nStudent Grade "
               + gradeLetter() + "\nStudent Full name: " + firstname + " "
               + lastname;
       return s;
   }

}

=========================================

// Test.java

import java.util.Scanner;

public class Test {

   public static void main(String[] args) {
       int choice;
       String fname,lname;
       int quiz1, quiz2, quiz3;
       Student s=null;

       /*
       * Creating an Scanner class object which is used to get the inputs
       * entered by the user
       */
       Scanner sc = new Scanner(System.in);

       while (true) {
           System.out.println("\n\nSTUDENT PROCESSING MENU");
           System.out.println("1. Create new Student – empty Account");
           System.out.println("2. Create new Student – information available");
           System.out.println("3. Set Student First Name:");
           System.out.println("4. Set Student Last Name:");
           System.out.println("5. Enter Quiz1 Score:");
           System.out.println("6. Enter Quiz2 Score:");
           System.out.println("7. Enter Quiz3 Score:");
           System.out.println("8. Get Quiz Average:");
           System.out.println("9. Get Student Id");
           System.out.println("10. Get Next Available Id");
           System.out.println("11. Compute Student Grade");
           System.out.println("12. Print Student Information");
           System.out.println("13. Exit");
           // Getting the input entered by the user
           System.out.print("Please enter your preferred option: ");
           choice = sc.nextInt();
           switch (choice) {
           case 1: {
               s=new Student();
System.out.println("StudentId#"+s.getId());
               continue;
           }
           case 2: {
               System.out.print("Please enter Student First Name:");
               fname=sc.next();
               System.out.print("Please enter Student Last Name:");
               lname=sc.next();
               continue;
           }
           case 3: {
               System.out.print("Please enter Student First Name:");
               fname=sc.next();
               s.setFirstname(fname);
               continue;
           }
           case 4: {

               System.out.print("Please enter Student Last Name:");
               lname=sc.next();
               s.setLastname(lname);
               continue;
           }
           case 5: {
               System.out.print("Enter Quiz1 Score:");
               quiz1=sc.nextInt();
               s.setQuiz1(quiz1);
               continue;
           }
           case 6: {
               System.out.print("Enter Quiz2 Score:");
               quiz2=sc.nextInt();
               s.setQuiz2(quiz2);
               continue;
           }
           case 7: {
               System.out.print("Enter Quiz3 Score:");
               quiz3=sc.nextInt();
               s.setQuiz3(quiz3);
               continue;
           }
           case 8: {
               System.out.println("Quiz Average :"+s.averageQuiz());
               continue;
           }
           case 9: {
               System.out.println("Studentid# :"+s.getId());
               continue;
           }
           case 10: {
               System.out.println("Next Studentid# :"+(s.getId()+1));
               continue;
           }
           case 11: {
               System.out.println("Student Grade :"+s.gradeLetter());
               continue;
           }
           case 12: {
               System.out.println("Student Grade :"+s);              
               continue;
           }
           case 13: {
               break;
           }
           default: {
               System.out.println("** Invalid Choice **");
               continue;
           }
           }
           break;
       }

   }

}

=======================================

Output:

STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 1
Student Successfully Created.
StudentId#1001


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 3
Please enter Student First Name:Kyle


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 4
Please enter Student Last Name:Potter


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 5
Enter Quiz1 Score:100


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 6
Enter Quiz2 Score:99


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 7
Enter Quiz3 Score:99


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 8
Quiz Average :99.33333333333333


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 9
Studentid# :1001


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 10
Next Studentid# :1002


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 11
Student Grade :A


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 12
Student Grade :StudentId: #1001
Quiz Score1: 100
Quiz Score2: 99
Quiz Score3: 99
Quiz Average: 99.33333333333333
Student Grade A
Student Full name: Kyle Potter


STUDENT PROCESSING MENU
1. Create new Student – empty Account
2. Create new Student – information available
3. Set Student First Name:
4. Set Student Last Name:
5. Enter Quiz1 Score:
6. Enter Quiz2 Score:
7. Enter Quiz3 Score:
8. Get Quiz Average:
9. Get Student Id
10. Get Next Available Id
11. Compute Student Grade
12. Print Student Information
13. Exit
Please enter your preferred option: 13

=====================Could you plz rate me well.Thank You

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Project 2 statement Please write this in JAVA. Please read this entire statement carefully before you...
Project 2 statement Please write this in JAVA. Please read this entire statement carefully before you start doing anything… This project involves implementing a simple university personnel management program. The program contains two different kinds of objects: students and faculty. For each object, the program stores relevant information such as university ID, name, etc. Different information is stored depending on the type of the object. For example, a student has a GPA, while a faculty has a title and department...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code to initialize the CustomerAccountsDB database table and add a set of customer accounts is provided. Finish the code in these 3 methods in CustomerAccountDB.java to update or query the database: -purchase(double amountOfPurchase) -payment(double amountOfPayment) -getCustomerName() Hint: For getCustomerName(), look at the getAccountBalance() method to see an example of querying data from the database. For the purchase() and payment() methods, look at the addCustomerAccount() method...
Finish the CustomerAccountTransactions program that reads customer accounts receivable data from a file and then applies...
Finish the CustomerAccountTransactions program that reads customer accounts receivable data from a file and then applies a series of transactions to the accounts. Its main() method uses the CustomerAccounts class to manage a collection of CustomerAccount objects: reading customer accounts data & transactions, and obtaining a String showing the customer accounts data after the operations are complete. You will need to complete the readCustomerAccounts () and applyTransactions() methods in the CustomerAccounts class. First, please fill in your name in the...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...