Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Kindly do it using C++ please provide valid code so that it produced the same output Programming Exercises 1. (Design a class for modelling courses)

Kindly do it using C++

please provide valid code so that it produced the same output

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

Programming Exercises 1. (Design a class for modelling courses) Suppose you need to process the information for a series of courses. Each course has a name and a number of students who take the course. You should be able to add/drop a student to/from the course. You can use a class to model the courses, as follows: Course -courseName: string -students: string The name of the course. An array of students who take the course. students is a pointer for the array The number of students (default: 0). The maximum number of students allowed for the cour course. -numberOfStudents: int -capacity: int +Course(courseName: string&, capacity: int) +-Course) +getCourseName(): string const +addStudent (name: string&): void +dropStudent (name: string&): void +getStudents(): string* const +getNumberOfStudents(): int const Creates a Course with the specified name and maximum number of students allowed. Destructor Returns the course name Adds a new student to the course. Drops a student from the course. Returns the array of students for the course. Returns the number of students for the course. The program source code (Course.h, Course.cpp, TestCourse.cpp) has been partly completed and is available on the VLE. There are some missing lines in the files (marked in the comments). Fill in the missing blocks of code to complete the program, then test it. An example of the output: Number of students in Data Structures: 0 Number of students in Database Systems: 0 Number of students in Data Structures: 3 Peter Jones, Brian Smith, Anne Kennedy Number of students in Database Systems: 2 Peter Jones, Steven Smith Number of students in Data Structures: 2 Brian Smith, Anne Kennedy Student Anne Kennedy is not on the Database Systems course - 0 X /** ** 1 DK > pass-to-function.cpp - Code::Blocks 20.03 File Edit View Search Project Build Debug Fortran wxSmith Tools Tools+ Plugins DoxyBlocks Settings Help t X = 49 C- 45: 4. Il li Workspace 2 using namespace std; 3 4 Evoid PrintArray (int a[], int n) { //Prints array numbers 5 for (int i=0;i Workspace 2 using namespace std; 3 4 int* reverse (const int* list, int size) 5 { 6 int* result = new int[size]; 7 for (int i=0, j = size-1; i Workspace 2 #include 3 using namespace std; 4 5 Fint main() { //Assign string literal and two pointers 6 7 char string[]="Supercalifragilisticexpialidocious.", *p1, *p2; 8 9 pl = p2 = string;//Make Dil & 02 point to string[0] 10 p2 = pl + strlen(string) - 1;//m2 points to string[end] 11 12 //Print letter at n2 and decrement until m2 = nil 13 while (p2 >= pl) { 14 cout <>

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

More Books

Students also viewed these Databases questions

Question

5. Describe the visual representations, or models, of communication

Answered: 1 week ago