■ 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
icon
Related questions
Question
■
Write Student and StudentTest classes.
Write Date and DateTest classes.
Private states
2 constructors
Public behaviors
>
<<Java Class>>
Student
(default package)
aid: int
Name: String
IName: String
Student(int)
Student(int, String, Strit g)
getld() int
setid (int) void
getfName(): String
setfName(String):void
getlName(): String
setlName(String):void
DisplayMessage():String
Private states
4 constructors.
Public behaviors
<<Java Class>>
Date
(default package)
> day: int
> month: int
a year: int
Date(Date)
Date(int)
Date(int,int)
Date(int,int,int)
getDay() int
setDay(int):void
get Month() int
setMonth(int) void
get Year() int
set Year(int) void
toString(): String
equals(Date) boolean
Transcribed Image Text:■ Write Student and StudentTest classes. Write Date and DateTest classes. Private states 2 constructors Public behaviors > <<Java Class>> Student (default package) aid: int Name: String IName: String Student(int) Student(int, String, Strit g) getld() int setid (int) void getfName(): String setfName(String):void getlName(): String setlName(String):void DisplayMessage():String Private states 4 constructors. Public behaviors <<Java Class>> Date (default package) > day: int > month: int a year: int Date(Date) Date(int) Date(int,int) Date(int,int,int) getDay() int setDay(int):void get Month() int setMonth(int) void get Year() int set Year(int) void toString(): String equals(Date) boolean
Expert Solution
Step 1: Student and StudentTest class Algorithm

Student Class:

  1. The Student class represents a student entity with the following attributes: id, fName (first name), and lName (last name).
  2. 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.
  3. Getter and setter methods are provided for each attribute (getId, setId, getfName, setfName, getlName, setlName).
  4. The DisplayMessage method returns a formatted string containing the student's information.

StudentTest Class:

  1. In the main method of the StudentTest class:
  2. 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.
  3. Another instance of Student named student2 is created using the constructor that takes first and last names.
  4. Information about both students is displayed using System.out.println statements, including ID, first name, last name, and the result of the DisplayMessage method.
steps

Step by step

Solved in 8 steps with 2 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
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.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education