Use a client code to test the course ADT: 1. Declare 2 course instances courseOne, and course Two ("CS 115", 01, 3, "Monday, Wednesday", "04:30 - 05:20", "CL", 126, 8, "Dr. X"). 8 is the maximum course enrolment. 2. Set the values of courseOne to ("CS 210", 02, 3, "Tuesday, Thursday", "10:30 - 11:20", "CL", 128, "Dr. Y"). The maximum course enrollment, which is 5, remains unchanged. 3. Display the values of courseOne and courseTwo. Also, use displayStudent List function to display IDs of students in each course. 4. Write a non-member function named course Compare that compares two course instances to check if any of the corresponding fields (excluding students Id) are the same and displays the result of the comparisons. For example, it could print "different course id number", ... "same number of credits", and so on. 5. Prompt user to enter a unique student id and then enroll it in courseOne 6. Use a loop to repeat step 5, 4 more times. 7. Prompt user to enter a unique student id and then enroll it in course Two 8. Use a loop to repeat step 7, 7 more times. 9. Use displayStudent List function to display IDs of students in each course. 10. Display the course status of both instances. 11. Prompt user to enter another unique student id and then try to enroll it in courseOne. If not possible, an error must be displayed indicating the course status. 12. Prompt user to enter another unique student id and then try to enroll it in courseTwo. If not possible, an error must be displayed indicating the course status.

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
(In C++) and please try using Occam’s razor law.
Use a client code to test the course ADT:
1. Declare 2 course instances courseOne, and course Two ("CS 115", 01, 3, "Monday,
Wednesday", "04:30 - 05:20", "CL", 126, 8, "Dr. X"). 8 is the maximum course enrolment.
2. Set the values of courseOne to ("CS 210", 02, 3, "Tuesday, Thursday", "10:30 - 11:20",
"CL", 128, "Dr. Y"). The maximum course enrollment, which is 5, remains unchanged.
3. Display the values of courseOne and courseTwo. Also, use
displayStudentList function to display IDs of students in each course.
4. Write a non-member function named courseCompare that compares two course
instances to check if any of the corresponding fields (excluding studentsId) are the
same and displays the result of the comparisons. For example, it could print "different
course id number", ... "same number of credits", and so on.
5. Prompt user to enter a unique student id and then enroll it in courseOne
6.
Use a loop to repeat step 5, 4 more times.
7. Prompt user to enter a unique student id and then enroll it in course Two
8. Use a loop to repeat step 7, 7 more times.
9. Use displayStudentList function to display IDs of students in each course.
10. Display the course status of both instances.
11. Prompt user to enter another unique student id and then try to enroll it in
courseOne. If not possible, an error must be displayed indicating the course status.
12. Prompt user to enter another unique student id and then try to enroll it in
course Two. If not possible, an error must be displayed indicating the course status.
Note: in addition to the specifications above, you may also need to add other data fields and (member)
functions.
Transcribed Image Text:Use a client code to test the course ADT: 1. Declare 2 course instances courseOne, and course Two ("CS 115", 01, 3, "Monday, Wednesday", "04:30 - 05:20", "CL", 126, 8, "Dr. X"). 8 is the maximum course enrolment. 2. Set the values of courseOne to ("CS 210", 02, 3, "Tuesday, Thursday", "10:30 - 11:20", "CL", 128, "Dr. Y"). The maximum course enrollment, which is 5, remains unchanged. 3. Display the values of courseOne and courseTwo. Also, use displayStudentList function to display IDs of students in each course. 4. Write a non-member function named courseCompare that compares two course instances to check if any of the corresponding fields (excluding studentsId) are the same and displays the result of the comparisons. For example, it could print "different course id number", ... "same number of credits", and so on. 5. Prompt user to enter a unique student id and then enroll it in courseOne 6. Use a loop to repeat step 5, 4 more times. 7. Prompt user to enter a unique student id and then enroll it in course Two 8. Use a loop to repeat step 7, 7 more times. 9. Use displayStudentList function to display IDs of students in each course. 10. Display the course status of both instances. 11. Prompt user to enter another unique student id and then try to enroll it in courseOne. If not possible, an error must be displayed indicating the course status. 12. Prompt user to enter another unique student id and then try to enroll it in course Two. If not possible, an error must be displayed indicating the course status. Note: in addition to the specifications above, you may also need to add other data fields and (member) functions.
Write a C++ program that defines an abstract data type course for modeling courses offered in a
university each semester. The class contains:
Data fields of type:
O
O
O
O
O
O
O
O
O
O
O
O
O
O
string that represents course id number
int that represents section number
int that represents number of credits for the course
string that represents day the course meets
string that represents time the course meets.
string that represents building the course meets
int that represents room number
int that represents maximum course enrollment.
Member functions:
O
string that represents course instructor
int that represents number of students currently enrolled¹*. Starting from 0, this
number is incremented by one when a student is enrolled in the course.
enum that represents course status (open, closed). Initially, a course is open until it
reaches the maximum enrollment and then it becomes closed.
string array named students Id that contains IDs of students who are enrolled in
the course ¹*
A default constructor. The default value for maximum course enrollment is 5.
A constructor that initializes a course object with the specified values. The last three
fields are initialized with the same values as they are initialized by the default
constructor.
The accessor and mutator functions for all the data fields. The accessor of
students Id filed returns one student id when it receives an index of the array.
O
A print function named displayData to display all information related to a course
object in a well-formatted fashion including a brief description for the fields. This
function excludes displaying information relevant to enrolled students.
O
A print function named displayStudent List to display (in a well-formatted
fashion) IDs of students who are enrolled in the course. If no one is enrolled in the
course, it will print "No students are enrolled for this class!"
Transcribed Image Text:Write a C++ program that defines an abstract data type course for modeling courses offered in a university each semester. The class contains: Data fields of type: O O O O O O O O O O O O O O string that represents course id number int that represents section number int that represents number of credits for the course string that represents day the course meets string that represents time the course meets. string that represents building the course meets int that represents room number int that represents maximum course enrollment. Member functions: O string that represents course instructor int that represents number of students currently enrolled¹*. Starting from 0, this number is incremented by one when a student is enrolled in the course. enum that represents course status (open, closed). Initially, a course is open until it reaches the maximum enrollment and then it becomes closed. string array named students Id that contains IDs of students who are enrolled in the course ¹* A default constructor. The default value for maximum course enrollment is 5. A constructor that initializes a course object with the specified values. The last three fields are initialized with the same values as they are initialized by the default constructor. The accessor and mutator functions for all the data fields. The accessor of students Id filed returns one student id when it receives an index of the array. O A print function named displayData to display all information related to a course object in a well-formatted fashion including a brief description for the fields. This function excludes displaying information relevant to enrolled students. O A print function named displayStudent List to display (in a well-formatted fashion) IDs of students who are enrolled in the course. If no one is enrolled in the course, it will print "No students are enrolled for this class!"
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Linux
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
  • SEE MORE 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