Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

1. Prepare a flowchart of Dr. Mahalees service encounters.

Answered: 1 week ago