Question

Create an abstract Student class for Parker University. The class contains fields for student ID number, last name, and annual tuition. Include a constructor that requires parameters for the ID number and name. Include get and set methods for each field; the setTuition() method is abstract.

Create three Student subclasses named UndergraduateStudent, GraduateStudent, and StudentAtLarge, each with a unique setTuition() method. Tuition for an UndergraduateStudent is $4,000 per semester, tuition for a GraduateStudent is $6,000 per semester, and tuition for a StudentAtLarge is $2,000 per semester.

----------------------------------------------------------------------------------------

public class GraduateStudent extends Student
{
public static final double GRAD_TUITION = 6000;
public GraduateStudent(String id, String name)
{
// write your code here
}
public void setTuition()
{
tuition = GRAD_TUITION;
}
}

----------------------------------------------------------------------------------------

public abstract class Student
{
private String id;
private String lastName;
protected double tuition;
public Student(String id, String name)
{
// write your code here
}
public void setId(String idNum)
{
// write your code here
}
public void setLastName(String name)
{
// write your code here
}
public String getId()
{
// write your code here
}
public String getLastName()
{
// write your code here
}
public double getTuition()
{
// write your code here
}
public abstract void setTuition();
}

----------------------------------------------------------------------------------------

public class StudentAtLarge extends Student
{
public static final double SAL_TUITION = 2000;
public StudentAtLarge (String id, String name)
{
// write your code here
}
public void setTuition()
{
tuition = SAL_TUITION;
}
}

----------------------------------------------------------------------------------------

public class StudentDemo
{
public static void main(String[] args)
{
Student students[] = new Student[6];
int i;
students[0] = new UndergraduateStudent("111", "Lambert");
students[1] = new UndergraduateStudent("122", "Lembeck");
students[2] = new GraduateStudent("233", "Miller");
students[3] = new GraduateStudent("256", "Marmon");
students[4] = new StudentAtLarge("312", "Nichols");
students[5] = new StudentAtLarge("376", "Nussbaum");
for(i = 0; i < students.length; ++i)
System.out.println("\nStudent # " +
students[i].getId() + " Name: " +
students[i].getLastName() + " Tuition: " +
students[i].getTuition() + " per year");
}
}

----------------------------------------------------------------------------------------

public class UndergraduateStudent extends Student
{
public static final double UNDERGRAD_TUITION = 4000;
public UndergraduateStudent(String id, String name)
{
// write your code here
}
public void setTuition()
{
tuition = UNDERGRAD_TUITION;
}
}

----------------------------------------------------------------------------------------

FILETREE Instructions - Studen... X Studen... X Studen... X Underg... X Gradua... X + > Terminal x + 1 public class Graduate

1 0
Add a comment Improve this question Transcribed image text
Answer #1

//----------------------------------------------------------------------------------------

public class GraduateStudent extends Student {

public static final double GRAD_TUITION = 6000;

public GraduateStudent(String id, String name) {

// write your code here

super(id, name);

setTuition();

}

public void setTuition() {

tuition = GRAD_TUITION;

}

}

// ----------------------------------------------------------------------------------------

public abstract class Student {

private String id;

private String lastName;

protected double tuition;

public Student(String id, String name) {

// write your code here

this.id = id;

this.lastName = name;

}

public void setId(String idNum) {

// write your code here

this.id = idNum;

}

public void setLastName(String name) {

// write your code here

this.lastName = name;

}

public String getId() {

// write your code here

return id;

}

public String getLastName() {

// write your code here

return lastName;

}

public double getTuition() {

// write your code here

return tuition;

}

public abstract void setTuition();

}

//----------------------------------------------------------------------------------------

public class StudentAtLarge extends Student {

public static final double SAL_TUITION = 2000;

public StudentAtLarge(String id, String name) {

// write your code here

super(id, name);

setTuition();

}

public void setTuition() {

tuition = SAL_TUITION;

}

}

// ----------------------------------------------------------------------------------------

public class StudentDemo {

public static void main(String[] args) {

Student students[] = new Student[6];

int i;

students[0] = new UndergraduateStudent("111", "Lambert");

students[1] = new UndergraduateStudent("122", "Lembeck");

students[2] = new GraduateStudent("233", "Miller");

students[3] = new GraduateStudent("256", "Marmon");

students[4] = new StudentAtLarge("312", "Nichols");

students[5] = new StudentAtLarge("376", "Nussbaum");

for (i = 0; i < students.length; ++i)

System.out.println("\nStudent # " + students[i].getId() + " Name: " + students[i].getLastName()

+ " Tuition: " + students[i].getTuition() + " per year");

}

}

// ----------------------------------------------------------------------------------------

public class UndergraduateStudent extends Student {

public static final double UNDERGRAD_TUITION = 4000;

public UndergraduateStudent(String id, String name) {

// write your code here

super(id, name);

setTuition();

}

public void setTuition() {

tuition = UNDERGRAD_TUITION;

}

}

====================================================

SEE OUTPUT

- - - - - - - - - - - - - - - - - - - 77 // ---------------------------- 78 79 public class Student Demo { 80 public static v

Thanks, PLEASE COMMENT if there is any concern. please UPVOTE

Add a comment
Know the answer?
Add Answer to:
Create an abstract Student class for Parker University. The class contains fields for student ID number,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • a) Create an abstract class Student. The class contains fields for student Id number, name, and...

    a) Create an abstract class Student. The class contains fields for student Id number, name, and tuition. Includes a constructor that requires parameters for the ID number and name. Include get and set method for each field; setTuition() method is abstract. b) The Student class should throw an exception named InvalidNameException when it receives an invalid student name (student name is invalid if it contains digits). c) Create three student subclasses named UndergradStudent, GradeStudent, and StudentAtLarge, each with a unique...

  • A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS...

    A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...

  • PART I: Create an abstract Java class named “Student” in a package named “STUDENTS”. This class...

    PART I: Create an abstract Java class named “Student” in a package named “STUDENTS”. This class has 4 attributes: (1) student ID: protected, an integer of 10 digits (2) student name: protected (3) student group code: protected, an integer (1 for undergraduates, 2 for graduate students) (4) student major: protected (e.g.: Business, Computer Sciences, Engineering) Class Student declaration provides a default constructor, get-methods and set-methods for the attributes, a public abstract method (displayStudentData()). PART II: Create a Java class named...

  • A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS...

    A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...

  • The method m() of class B overrides the m() method of class A, true or false?...

    The method m() of class B overrides the m() method of class A, true or false? class A int i; public void maint i) { this.is } } class B extends A{ public void m(Strings) { 1 Select one: True False For the following code, which statement is correct? public class Test { public static void main(String[] args) { Object al = new AC: Object a2 = new Object(); System.out.println(al); System.out.println(a): } } class A intx @Override public String toString()...

  • A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 21...

    A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...

  • What is wrong with the following Java Code. public class TestEdible { abstract class Animal {...

    What is wrong with the following Java Code. public class TestEdible { abstract class Animal { /** Return animal sound */ public abstract String sound(); } class Chicken extends Animal implements Edible { @Override public String howToEat() { return "Chicken: Fry it"; } @Override public String sound() { return "Chicken: cock-a-doodle-doo"; } } class Tiger extends Animal { @Override public String sound() { return "Tiger: RROOAARR"; } } abstract class Fruit implements Edible { // Data fields, constructors, and methods...

  • Write a program in Java that prompts a user for Name and id number. and then...

    Write a program in Java that prompts a user for Name and id number. and then the program outputs students GPA MAIN import java.util.StringTokenizer; import javax.swing.JOptionPane; public class Main {    public static void main(String[] args) {                       String thedata = JOptionPane.showInputDialog(null, "Please type in Student Name. ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE);        String name = thedata;        Student pupil = new Student(name);                   //add code here       ...

  • You will create a class to keep student's information: name, student ID, and grade. The program...

    You will create a class to keep student's information: name, student ID, and grade. The program will have the following functionality: - The record is persistent, that is, the whole registry should be saved on file upon exiting the program, and after any major change. - The program should provide the option to create a new entry with a student's name, ID, and grade. - There should be an option to lookup a student from his student ID (this will...

  • Given a class called Student and a class called Course that contains an ArrayList of Student....

    Given a class called Student and a class called Course that contains an ArrayList of Student. Write a method called getDeansList() as described below. Refer to Student.java below to learn what methods are available. I will paste both of the simple .JAVA codes below COURSE.JAVA import java.util.*; import java.io.*; /****************************************************** * A list of students in a course *****************************************************/ public class Course{     /** collection of Students */     private ArrayList<Student> roster; /***************************************************** Constructor for objects of class Course *****************************************************/...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT