rite a class named Student. The class contains: ■ Private String data field “name” that refers to the name of the student. ■ Private integer data field “id” that refers to the student id. ■ Private Date data field “dateCreated” that refers to the current date when a new object Student is created. ■ A constructor that creates a new instance of the class student with the specified name and id. ■ Three methods named getName(), getID() and getDateCreated() that return

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a class named Student. The class contains:
■ Private String data field “name” that refers to the name of the student.
■ Private integer data field “id” that refers to the student id.
■ Private Date data field “dateCreated” that refers to the current date when a
new object Student is created.
■ A constructor that creates a new instance of the class student with the specified
name and id.
■ Three methods named getName(), getID() and getDateCreated() that return
respectively the name, the id and the date when the student object was created.
■ A toString() method that return a String representation of the student.
2. Write a class named Course. The class contains:
■ Private String data field “courseName” that refers to the name of the course.
■ Private integer data field “capacity” that refers to the capacity of the course
(default value 10).
■ Private ArrayList of students that contains the students registered in the
course.
■ A constructor that creates a new course with the specified name.
■ A method named addStudent(Student s1) that add a specific student to the
course (if course is full, call the method overload).
■ A method named overloadStudent(Student s1) that overload a specific student
to the course (capacity should be increased by 1).
■ A method named dropStudent(Student s1) that drops a specific student from
the course (it should print “student not found” in case the student was not found
in the list).
■ A method named getStudents() that return the registered students in the
course.
■ A method named getNumberOfStudenstInCourse() that returns the number of
registered students in the course.
■ A method named getCourseName() that return the name of the course.
■ A toString() method that return a description of the course.
Write a program called testCourse to test your class. Below is a sample output
of the driver class after creating a course called “Computer Programming” and
adding 4 students to the course:
Computer Programming:
Thu Apr 22 11:37:40 EEST 2021: 202010, Peter Jones
Thu Apr 22 11:37:40 EEST 2021: 202015, Brian Smith
Thu Apr 22 11:37:40 EEST 2021: 202013, Anne Kennedy
Thu Apr 22 11:37:40 EEST 2021: 202080, Steve Smith

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY