This assignment has already been turned in and graded. It was an assignment I had trouble with and would like to review

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

This assignment has already been turned in and graded. It was an assignment I had trouble with and would like to review

Post by answerhappygod »

This assignment has already been turned in and graded. It was an
assignment I had trouble with and would like to review
the code for my final which is tomorrow.
Design a class called Student. A student object has
following
private class variables.
String first; //holds first name of the student
String last; //holds last name of the student
double totalScore; //holds total score of the student
char grade; // //holds grade obtained by the student.
Student class has following methods:
Student()
Student(String f, String s, double score)
getFirst(): String //returns first name of the student
getLast(): String //returns last name of the student
getTotalScore(): double //returns total score of the student
getGrade(): char //returns the grade based on the totalScore
calculateGrade(): void//set grade value to the obtained
grade.
Calculate the grade based on total score. If the total
score>=
90, grade will be ‘A’, If the total score is in between 80
and
90, grade will be ‘B’, If the total score is in between 70
and
80, grade will be ‘C’, If the total score is in between 60
and
70, grade will be ‘D’, If the total score <=60 grade will
be
‘F’.
displayDetails(): void // display’s the student details and
his
grade
Create StudentHelper class. Do the following.
1. Create a scanner object
2. Ask the user, how many students are present.
3. Create an array of Student objects based on the number of
students entered by the user.
4. For each student ask the user about the first name, last
name and totalScore he obtained.
5. create an Student object using Student class using
regular constructor.
6. Once, you get the all students details.
7. For each student calculate the grade.
8. Display the student details using toString method and
corresponding grade.
Sample output:
Enter the number of students
¼¼§M3
MM§MEnter first name of the student
¼¼§MMary
MM§MEnter last name of the student
¼¼§MSmith
MM§MEnter total score student
¼¼§M89
MM§MEnter first name of the student
¼¼§MAlex
MM§MEnter last name of the student
¼¼§MGarcia
MM§MEnter total score student
¼¼§M59
MM§MEnter first name of the student
¼¼§MAllen
MM§MEnter last name of the student
¼¼§MCarter
MM§MEnter total score student
¼¼§M95
MM§MName of the student: Mary Smith
MM§MTotal score: 89.0
MM§MGrade: B
MM§MName of the student: Alex Garcia
MM§MTotal score: 59.0
MM§MGrade: F
MM§MName of the student: Allen Carter
MM§MTotal score: 95.0
MM§MGrade: A
MM§M
MM©M
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply