Question: Student.Java public class Student { private int studentNumber = 0; private String lastName= NoLast; private String firstName= NoFirst; private String major= Unspecified; private int credits


Student.Java
public class Student { private int studentNumber = 0; private String lastName= "NoLast"; private String firstName= "NoFirst"; private String major= "Unspecified"; private int credits = 0; int StudyTime;
public Student(int studentNumber, String lastName, String firstName, String major, int credits) {
this.setstudentNumber(studentNumber); this.setlastName(lastName); this.setfirstName(firstName); this.setmajor(major); this.setcredits(credits);
}
public void setStudentNumber(int studentNumber){ this.studentNumber = studentNumber; }
public void setlastName(String lastName){ this.lastName = lastName; }
public void setfirstName(String firstName){ this.firstName = firstName; }
public void major(String major){ this.major = major; }
public void setcredits(int credits){ this.credits = credits; }
public int getstudentNumber() {return studentNumber;} public String getlastName() {return lastName;} public String getfirstName() {return firstName;} public String getmajor() {return major;} public int getcredits() {return credits;}
public int calcStudyTime(int creds); {StudyTime = creds * 3; return StudyTime; }
}
DemoStudent.Java has not been created. There are several issues with Student.Java.
1. Student.java and DemoStudent.java a. Student.java is a class that should contain the following: I. Private instance fields: 1. Student Number 2. Student Last Name 3. Student First Name 4. Student's Major 5. Number of credits being taken by student ii. Constructors 1. A "no-arg" constructor that initializes values as follows: a. Student Number set to zero b. Student Last Name set to "NoLast" C. Student First Name set to "NoFirst" d. Student's Major set to "Unspecified" e. Number of credits being taken by student set to zero 2. A constructor that accepts arguments for all of the instance fields iii. Getters and Setters 1. For every instance field, there should be a "get" and a "set" method. iv. calcStudy Time method 1. This method accepts the number of credits being taken by the student 2. This method returns the amount of study time expected (3 times the number of credits) b. DemoStudent.java Create an object referenced as firstStudent by using the "no-arg" constructor. Display the data from firstStudent. This will require the use of your "get" methods along with System.out.println. 3. Create an object referenced as secondStudent by using the constructor that accepts arguments, passing it your own student number, your own last name, your own first name, your own major, and your own number of credits being taken. 4. Display the data from secondStudent. This will require the use of your "get" methods along with System.out.println. 5. Display the amount of study time expected for secondStudent by calling the calcStudytime method. 6. Add variables as needed to enable you to ask your user to input the student number, last name, first name, major, and number of credits being taken. Write the code needed to ask your user for this data and store it in the variables. Use the Scanner class and its methods for this. Create an object referenced as thirdStudent by using the "no-arg" constructor. 8. Call your "set" methods for the student number, last name, first name, major, and number of credits being taken, passing the data just collected from your user to each set method to populate thirdStudent with this data. Display the data from thirdStudent. This will require the use of your "get" methods along with System.out.println. 10. Display the amount of study time expected for third Student by calling the calcStudytime method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
