Question: Student.java public class Student { //declarations private int studentNumber = 0; private String lastName; private String firstName; private String major ; private int credits ;

 Student.java public class Student { //declarations private int studentNumber = 0;

Student.java

public class Student {

//declarations private int studentNumber = 0; private String lastName; private String firstName; private String major ; private int credits ; int StudyTime; String Status;

public Student() { studentNumber=0; lastName="NoLast"; firstName="NoFirst"; major="Unspecified"; credits=0; }

//Syntax for Student 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);

}

//Set statements

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 setmajor(String major){ this.major = major; }

public void setcredits(int credits){ this.credits = credits; }

//Get statements 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;}

//Calculate studyTime public int calcStudyTime() {StudyTime = credits * 3; return StudyTime; }

//Get Level

public String getLevel (){ if (credits

DemoStudent.java

import java.util.Scanner;

public class DemoStudent { public static void main(String args[]) { //Declarations int stunum ; String lname; String fname; String major; int creds; System.out.println("DemoStudent by xxxxxx");

//Create firstStudent (default values) Student firstStudent=new Student();

//Print firstStudent System.out.println(firstStudent.getstudentNumber()); System.out.println(firstStudent.getlastName()); System.out.println(firstStudent.getfirstName()); System.out.println(firstStudent.getmajor()); System.out.println(firstStudent.getcredits()); System.out.println("Student's level is: " + firstStudent.getLevel()); //Create secondStudent Student secondStudent=new Student(21438, "Andres", "Colt", "Psychology", 21);

//Print secondStudent System.out.println(secondStudent.getstudentNumber()); System.out.println(secondStudent.getlastName()); System.out.println(secondStudent.getfirstName()); System.out.println(secondStudent.getmajor()); System.out.println(secondStudent.getcredits()); System.out.println("Study : "+secondStudent.calcStudyTime()); System.out.println("Student's level is: " + secondStudent.getLevel());

//Initialize scanner Scanner keyboard = new Scanner(System.in);

//Get information for thirdStudent System.out.println("Enter Student Number : "); stunum = keyboard.nextInt();

// Consume the remaining newline. keyboard.nextLine(); System.out.print("Enter the Last Name : "); lname = keyboard.nextLine();

System.out.print("Enter the First Name : "); fname = keyboard.nextLine();

System.out.print("Enter Student's major : "); major = keyboard.nextLine();

do{ System.out.print("Enter number of credits : "); creds = keyboard.nextInt();

} while (creds >=0 && creds

//Create thirdStudent Student thirdStudent = new Student(stunum, lname, fname, major, creds);

//print thirdStudent System.out.println(thirdStudent.getstudentNumber()); System.out.println(thirdStudent.getlastName()); System.out.println(thirdStudent.getfirstName()); System.out.println(thirdStudent.getmajor()); System.out.println(thirdStudent.getcredits());

System.out.println("Calculate Study TIme : "+thirdStudent.calcStudyTime()); System.out.println("Student's level is: " + thirdStudent.getLevel()); } }

4. Student.java and DemoStudent.java updates (suggest copying these from Project 1 work into a new folder) a. Add a method to Student.java called getLevel. This method accepts the number of credits a student is taking and returns a String, depending on the number of credits: i. 0-5 credits - returns "Part-Time Student" ii. 6-8 credits - returns "Half-Time Student" iii. 9-11 credits -returns "Three-Quarter Student" iv. 12 or more credits - returns "Full-Time Student" b. Add code to DemoStudent.java: i. In the keyboard input section, do not let the user enter less than 0 or more than 20 for the number of credits. ii. Display the student's level for firstStudent, secondStudent, and third Student by calling the getLevel method. 5. WriteMyFile.java and ReadMyFile.java - Write an application that creates a text file that consists of an inventory of items you would want with you if you were ever stranded on a desert island. Then write the application that reads and displays that data

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!