Question: USE JAVA LANGUAGE USE JAVA LANGUAGE Please write code that meets the following requirements: Create an abstract class called Student Has private attributes name (String),

USE JAVA LANGUAGE

USE JAVA LANGUAGE

Please write code that meets the following requirements:

Create an abstract class called Student

Has private attributes name (String), mayLiveOnCampus (boolean)

Create a constructor that requires both parameters

Has getters for name and mayLiveOnCampus (but not setters)

Has a toString () method implemented (use NetBeans for this)

Has a public abstract boolean method called hasPriorityEnrollment ()

Create a concrete class called MatriculatedStudent

Inherits from Student

Has a private attribute for Student ID named studentId (string)

Implements only one constructor that requires BOTH name and student

ID, and calls the superclass constructor with the name plus true for

mayLiveOnCampus

Implements hasPriorityEnrollment (), returns true

Create a concrete class called NonMatriculatedStudent

Inherits from Student

Has a private attribute for Social Security Number named ssn (string)

Implements only one constructor that requires BOTH name and SSN, and

calls the superclass constructor with the name plus false for

mayLiveOnCampus

Implements hasPriorityEnrollment (), returns false

Create a class Main which has a main method like this:

 public static void main(String[] args) { Student s1 = new MatriculatedStudent("Deena", "SB158320"); Student s2 = new NonMatriculatedStudent("Edward", 
"123-45-6789" ); 
 System.out.println(s1); System.out.println(s2); 

}

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!