Question: / * - - - - - - - - - - - - - - - - - - - - - - -

/*---------------------------------------------------------------------------
// AUTHOR:
// SPECIFICATION: This program is for practicing the use of classes, constructors,
// helper methods, and the this operator.
// INSTRUCTIONS: Read the following code skeleton and add your own code
// according to the comments
//-------------------------------------------------------------------------*/
import java.util.Scanner;
public class
{
public static void main(String[] args)
{
// Let's make two students using all two constructors
// Write code to create a new student alice using constructor #1
//-->
Student alice =
// Write code to create a new student bob with name "Bob Brown",
// age 23 and GPA 3.8 using constructor #2
//-->
// Let's get user input to change the missing or default values
Scanner scan = new Scanner(System.in);
// Get user input and set Alice's full name
System.out.print("Enter full name for Alice: ");
alice.setName(scan.nextLine());
// Get user input and set Alice's age
// Write code to get user input and set Alice's GPA
//-->
// Lets print out the students details
alice
bob
System.out.println("\r
Changing Bob's GPA");
// Get user input and change bob's gpa
// Write code to print out bob's new details
//-->
System.out.println("\r
Comparing Alice and Bob");
Student better = alice.betterGPA(bob);
System.out.println(better.getName()+" has a better GPA");
// Use the olderStudent method to figure out which student is
// older between Alice and Bob. Then print out the result. Follow
// the betterGPA example above.
//-->
// Finally, print out each student's details 3 times, using the print(int n) method
//-->
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!