■ Write Student and StudentTest classes. ■ Write Date and DateTest classes. Private states 2 constructors Public behaviors <> Student (default package) id: int Name: String IName: String Student(int) Student(int, String, Strit g) getid) int setid(int) void getfName(): String setfName(String) void getlName(): String setiName(String) void DisplayMessage() String Private states 4 constructors. Public behaviors <> Date (default package) > day: int Pamonth: int Pa year: int Date(Date) Date(int) Date(int,int) Date(int,int,int) getDay() int set Day(int) void getMonth() int setMonth(int) void get Year() int set Year(int) void toString(): String equals(Date) boolean
■ Write Student and StudentTest classes. ■ Write Date and DateTest classes. Private states 2 constructors Public behaviors <> Student (default package) id: int Name: String IName: String Student(int) Student(int, String, Strit g) getid) int setid(int) void getfName(): String setfName(String) void getlName(): String setiName(String) void DisplayMessage() String Private states 4 constructors. Public behaviors <> Date (default package) > day: int Pamonth: int Pa year: int Date(Date) Date(int) Date(int,int) Date(int,int,int) getDay() int set Day(int) void getMonth() int setMonth(int) void get Year() int set Year(int) void toString(): String equals(Date) boolean
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Expert Solution
Step 1: Student and StudentTest class Algorithm
Student Class:
- The Student class represents a student entity with the following attributes: id, fName (first name), and lName (last name).
- It provides two constructors:
public Student(int id): Initializes the id of the student and leaves fName and lName as null.
public Student(String fName, String lName): Initializes the fName and lName of the student and leaves id as 0. - Getter and setter methods are provided for each attribute (getId, setId, getfName, setfName, getlName, setlName).
- The DisplayMessage method returns a formatted string containing the student's information.
StudentTest Class:
- In the main method of the StudentTest class:
- An instance of Student named student1 is created using the constructor that takes an id. The first name and last name are then set using setter methods.
- Another instance of Student named student2 is created using the constructor that takes first and last names.
- Information about both students is displayed using System.out.println statements, including ID, first name, last name, and the result of the DisplayMessage method.
Step by step
Solved in 8 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education