Question
So... I was given the following java program to write using codeblocks. Im new at java so just looking at this confuses me After you
So... I was given the following java program to write using codeblocks. Im new at java so just looking at this confuses me
After you have created your NetBeans Project your application class StudentClient should contain the following executable code:
package studentclient;public class StudentClient {
public static void main(String[] args) { }
} Your service class should contain the following executable code:
package studentclient;public class Student { }
In the StudentClient application class main method code the instructions to perform the tasks indicated in the remarks :
package studentclient; public class StudentClient{
public static void main( String [] args ){
/* Declare two object references of type Student s1 and s2 and instantiate two Student objects passing three arguments to the constructor for the class. Use different values for each class object */
// Your code here
/* Output the name, social security number and GPA of the student from object reference s1 using the appropriate accessor methods to obtain the data */
// Your code here
/* Output the name, social security number and GPA of the student from object reference s2 using the toString method to return the data */
// Your code here
} }
{
/* Using the equals method and a selection control structure (if statement), compare objects s1 and s2 and output an appropriate message indicating if the objects are equal */
// Your code here
/* Using the appropriate mutator methods on student object s2, change the name, social security number and GPA to the same values as in object s1. Use the set methods. */
// Your code here
/* Again, using the equals method and a selection control structure (if statement), compare objects s1 and s2 and output an appropriate message indicating if the objects are equal */
// Your code here
In the Student service class code the instructions to define your Student service class structure with the appropriate constructors, mutator methods, accessor methods as well as a toString and an equals method :
package studentclient;public class Student
/* Declare three instance variables to represent the student name, social security number and GPA */
// Your code here
/* Overloaded constructor method: Allows client to set beginning values for name, ssn, and gpa. This constructor takes three parameters and calls mutator methods to validate new values */
public Student( String newName, String newSsn, double newGpa ) {
// Your code here
} /* getName accessor method */
public String getName( ) {
// Your code here
} /* setName mutator method */
public void setName( String newName ) {
// Your code here
}
/* getSsn accessor method */
public String getSsn( ) {
// Your code here
} /* setSSN mutator method */
public void setSsn( String newSsn ) {
// Your code here
} /* getGpa accessor method */
public double getGpa( ) {
// Your code here
}
public void setGpa( double newGpa ) {
// Your code here
}
public String toString( ) {
/* setGpa mutator method: Allows client to set value of gpa and prints an error message if new value is either less than 0 or greater than 4.0. setGpa does not change the value of gpa if newGpa is negative or greater than 4.0 */
/* toString method returns student name, social security number and GPA */
// Your code here
}
public boolean equals( Object o ) {
// Your code here
} }
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