Question
JAVA 1) public class FileConstructorExample { /** * @param args the command line arguments */ public static void main(String[] args) { //Task #1 - See
JAVA
1)
public class FileConstructorExample {
/** * @param args the command line arguments */ public static void main(String[] args) { //Task #1 - See Domain class //Task #2 - See Domain class
//Task #3 //Create a method that will read the input file, create a Student object, and print the student object //Task #4 //Create a method that will ask the user for a new first name, last name, panther id, and gpa of another student //In the same method, save the information into the same file, overlaying the data that was there before. //Task #5 //Run the program & check what the file looks like. } }
2)
package fileconstructorexample;
public class Student { String lastName, firstName, pantherId; double gpa; //Task 1: //Define a DEFAULT Constructor that initializes gpa to 1.0, and the rest to blanks //Task 2: //Define a NON-Default Constructor that received parameters for every instance variable, //& initializes each variable with the corresponding parameter
public String getLastName() { return lastName; }
public String getFirstName() { return firstName; }
public String getPantherId() { return pantherId; }
public void setLastName(String lastName) { this.lastName = lastName; }
public void setFirstName(String firstName) { this.firstName = firstName; }
public void setPantherId(String pantherId) { this.pantherId = pantherId; }
public void setGpa(double gpa) { this.gpa = gpa; }
public double getGpa() { return gpa; }
@Override public String toString() { return "Student{" + "lastName=" + lastName + ", firstName=" + firstName + ", pantherId=" + pantherId + ", gpa=" + gpa + '}'; } }
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