Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Java C+ Using the same classes from the last assignment, app and student , create an application that tracks and displays the student's

Please use Java C+

Using the same classes from the last assignment, app and student, create an application that tracks and displays the student's GPA for 8 semesters.

image text in transcribed

Things to implement:

  • Create a method in the class student that returns the student's GPA.
    • Have this method generate the GPA randomly in a range between 0 and 4.0.
  • Implement a for loop in the application to call for the student's GPA 8 times.
  • Display a number to account for the semester (from 1 to 8) and the student's name and GPA for each semester
  • At the end update the student's attribute GPA and display the student's name and the final GPA (the average of the 8 semesters).
  • Do not add any new attributes or variables to the student class.
  • The only change to the student class should be the addition of the new method.

For instance, a report could look like this:

Semester 1 - John's GPA is 3.5

Semester 2 - John's GPA is 2.0

Semester 3 - John's GPA is 4.0

........................................

Semester 8 - John's GPA is 3.0

___________________________

John's average GPA is 3.2

Suggestions

If you need some help, see below for some suggestions:

My suggestion below is a step-by-step solution. Try to implement each step, one at a time.

1 - Start with your assignment 01. The new method semesterGPA() is one more method in the student class. The student class should still have everything as in the last assignment.

2 - Create a method called semesterGPA() in the student class. This method is going to return a random value between 0.0 and 4.0. Every time the method is called, it calculates a new random number and returns it.

3 - Change the app.

  • App doesn't need the if statements from assignment 01
  • App doesn't need 3 students as in assignment 01. This time you need only one student object.
  • Include a for loop for the interaction through the 8 semesters.
  • In the for loop display the student's name and semesterGPA
  • Start accumulating data to calculate later the average GPA
  • After the for loop,
    • Calculate the average GPA
    • Update the student GPA attribute with the calculated average GPA
    • Display the student average GPA using the student GPA attributes
app 1-Creates 1 student object student 2-For Loop Using the student object, get the semester GPA Display student name and semesterGPA Accumulate data for calculating average GPA later First name Last name Age GPA getInfo(). semesterGPAO). 3-Calculate the average GPA | 4-update the student GPA attribute with the calculated average GPA 5-Display the student average GPA using the student GPA attribute

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions