Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class Student f private String name; private String major private double gpa: private int hours; public Student (String newName, String newMajor, double newGpa, int
public class Student f private String name; private String major private double gpa: private int hours; public Student (String newName, String newMajor, double newGpa, int newHours) t name = newName; major - newMajor; gpa = newGpa; hours -newHours public String tostring) // Type your code here* Assume that studentAmy is an Student object with the following attributes name is "Amy Farrell, major is "History". gpa is 3.87 and hours is 14. (These are all given and stored in the studentAmy object) The following statement is trying to print the object: System.out.println (studentAmy): Write the toString method so that the output of object will display all information of Amy. The output will also add one of the following comment: 1. if the gpa3.5- " You are an excellent student!" 2. if the gpa >= 2.0-"You are making your grades just fine." 3. otherwise - Woops! Need a little more effort! a sample output is shown below .C:Windows system32 cmd.exe C: Users\mthou\Desktop> java Test1 Amy Farrell, You have registered 14 hours this semester Your gpa is 3.8.7 You are an excellent student! C: \Users\mthou\Desktop> Please type ONLY the toString method in the answer box
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