Create two classes and a main function and save it in a file with your +PR1.cpp for the following class definitions and main instructions. Course +number (string) +credits (int) (must be a value greater than 0) accessors, mutators, default constructor Default constructor sets name to "CSC101" and credits to 3 Overloaded constructor takes two parameters for number and credits Student +name (string) +enroll (Course) accessors, mutators, default constructor Default constructor sets name to an empty string. In main() 1. Declare a string variable named cnumber. 2. Declare an int variable named ccredits. 3. Declare a string variable named sname. 4. Instantiate a Course object called c1 using its default constructor. 5. Enter a string value from the keyboard and store in variable cnumber. 6. Set c1 object's number attribute to cnumber. 7. Enter an int value from the keyboard and store in variable ccredits. 8. Set c1 object's credits attribute to ccredits. 9. Create a Course object called c2 using its overloaded constructor setting number attribute to "CSC350" and credits attribute to 4 10.Create a third Course object called c3 using its default constructor. 11.Set c3 object's number attribute to "ELECTIVE" 12.Set c3 object's credits attribute to the sum of the c1 object's credits attribute plus c2 object's credits attribute. 13.Create a Student object called s1 using default constructor. 14.Enter a string value from the keyboard and store in variable sname. 15.Set s1 object's name attribute to a sname. 16.Set s1 object's enroll attribute to c2 17.Create a Student object called s2 using overloaded constructor, setting name attribute to "TANG" and enroll attribute to c1; 18.Create a Student object called s3 using default constructor. 19.Set s3 object's name attribute to s1 object's name attribute. 20.Set s3 object's enroll attribute to s2 object's enroll attribute. 21.Display name, course, credits attributes for s1 object. 22.Display name, course, credits attributes for s2 object. 23.Display name, course, credits attributes for s3 object. Execute the main() program to make sure that the program runs without errors.

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

Please!! 

Create two classes and a main function and save it in a file with your
<lastname>+PR1.cpp for the following class definitions and main instructions.
Course
+number (string)
+credits (int) (must be a value greater than 0)
accessors, mutators, default constructor
Default constructor sets name to "CSC101" and credits to 3
Overloaded constructor takes two parameters for number and credits
Student
+name (string)
+enroll (Course)
accessors, mutators, default constructor
Default constructor sets name to an empty string.
In main()
1. Declare a string variable named cnumber.
2. Declare an int variable named ccredits.
3. Declare a string variable named sname.
4. Instantiate a Course object called c1 using its default constructor.
5. Enter a string value from the keyboard and store in variable cnumber.
6. Set c1 object's number attribute to cnumber.
7. Enter an int value from the keyboard and store in variable ccredits.
8. Set c1 object's credits attribute to ccredits.
9. Create a Course object called c2 using its overloaded constructor setting
number attribute to "CSC350" and credits attribute to 4
10.Create a third Course object called c3 using its default constructor.
11.Set c3 object's number attribute to "ELECTIVE"
12.Set c3 object's credits attribute to the sum of the c1 object's credits
attribute plus c2 object's credits attribute.
13.Create a Student object called s1 using default constructor.
14.Enter a string value from the keyboard and store in variable sname.
15.Set s1 object's name attribute to a sname.
16.Set s1 object's enroll attribute to c2
17.Create a Student object called s2 using overloaded constructor, setting name
attribute to "TANG" and enroll attribute to c1;
18.Create a Student object called s3 using default constructor.
19.Set s3 object's name attribute to s1 object's name attribute.
20.Set s3 object's enroll attribute to s2 object's enroll attribute.
21.Display name, course, credits attributes for s1 object.
22.Display name, course, credits attributes for s2 object.
23.Display name, course, credits attributes for s3 object.
Execute the main() program to make sure that the program runs without errors.
Transcribed Image Text:Create two classes and a main function and save it in a file with your <lastname>+PR1.cpp for the following class definitions and main instructions. Course +number (string) +credits (int) (must be a value greater than 0) accessors, mutators, default constructor Default constructor sets name to "CSC101" and credits to 3 Overloaded constructor takes two parameters for number and credits Student +name (string) +enroll (Course) accessors, mutators, default constructor Default constructor sets name to an empty string. In main() 1. Declare a string variable named cnumber. 2. Declare an int variable named ccredits. 3. Declare a string variable named sname. 4. Instantiate a Course object called c1 using its default constructor. 5. Enter a string value from the keyboard and store in variable cnumber. 6. Set c1 object's number attribute to cnumber. 7. Enter an int value from the keyboard and store in variable ccredits. 8. Set c1 object's credits attribute to ccredits. 9. Create a Course object called c2 using its overloaded constructor setting number attribute to "CSC350" and credits attribute to 4 10.Create a third Course object called c3 using its default constructor. 11.Set c3 object's number attribute to "ELECTIVE" 12.Set c3 object's credits attribute to the sum of the c1 object's credits attribute plus c2 object's credits attribute. 13.Create a Student object called s1 using default constructor. 14.Enter a string value from the keyboard and store in variable sname. 15.Set s1 object's name attribute to a sname. 16.Set s1 object's enroll attribute to c2 17.Create a Student object called s2 using overloaded constructor, setting name attribute to "TANG" and enroll attribute to c1; 18.Create a Student object called s3 using default constructor. 19.Set s3 object's name attribute to s1 object's name attribute. 20.Set s3 object's enroll attribute to s2 object's enroll attribute. 21.Display name, course, credits attributes for s1 object. 22.Display name, course, credits attributes for s2 object. 23.Display name, course, credits attributes for s3 object. Execute the main() program to make sure that the program runs without errors.
Expert Solution
trending now

Trending now

This is a popular 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