
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
DO IT IN C++

Transcribed Image Text:### Programming Exercise: Class Definitions and Main Function
#### Task Overview:
Create two classes and a main function, and save the file as `<lastname>+PR1.cpp` using the following instructions for class definitions and main functionality.
#### Class Definitions:
**Course**
- **Attributes:**
- `+number` (string)
- `+credits` (int; must be a value greater than 0)
- **Constructors and Methods:**
- Accessors, mutators, default constructor
- Default constructor initializes `number` to "CSC101" and `credits` to 3
- Overloaded constructor accepts two parameters for `number` and `credits`
**Student**
- **Attributes:**
- `+name` (string)
- `+enroll` (Course)
- **Constructors and Methods:**
- Accessors, mutators, default constructor
- Default constructor initializes `name` to an empty string
#### Main Function Instructions:
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. Input a `string` from the keyboard and store it in `cnumber`.
6. Set `c1` object's `number` attribute to `cnumber`.
7. Input an `int` from the keyboard and store it in `ccredits`.
8. Set `c1` object's `credits` attribute to `ccredits`.
9. Create a `Course` object called `c2` using its overloaded constructor with `number` set to "CSC350" and `credits` set to 4.
10. Create another `Course` called `c3` using its default constructor.
11. Set `c3` object's `number` attribute to "ELECTIVE".
12. Set `c3` object's `credits` to the sum of `c1` and `c2` objects' `credits`.
13. Declare a `Student` object called `s1` using the default constructor.
14. Input a `string` from the keyboard and store it in `sname`.
15. Set `s1` object's `name` attribute to `sname`.
16. Set `s1` object's `enroll`
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 3 images

Knowledge Booster
Similar questions
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education