Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago