Question
BEFORE BEGINNING PLEASE READ ALL INSTRUCTIONS OR I WILL DOWN VOTE YOUR ANSWER. It is detrimental that these instructions are followed: - The code must
BEFORE BEGINNING PLEASE READ ALL INSTRUCTIONS OR I WILL DOWN VOTE YOUR ANSWER.
It is detrimental that these instructions are followed:
- The code must be written in C++ only.
- The code absolutely must be divided into a .cpp and .h file, and please comment wherever possible so that I can see how you did this.
- Please make sure that all class attributes are private and are accessed through public member functions.
- Ensure the sample output looks as similar as the one provided. Otherwise, it is considered incorrect.
- If possible, post a screenshot of your test output to show that it works.
- Please ensure that the file names are accurate and match the instructions.
Thank you for reading the instructions, and please do your best so I can learn from what you did accurately.
Part 1: Design a Course class that contains individual course information and has the following private attributes long string int courseNumber courseName numberOfCredits All class attributes must be private and accessed through public member functions. You need to write the following public methods Default constructor that sets courseNumber to 0, courseName to "", and number ofCredits to 0. Overloaded constructor that takes 3 parameters used to initialize the 3 attributes Set function(s) that set the objects data. Print function that displays the object data in a neat fashion. After you design your class, write a main program that instantiates 2 Course objects, sets and displays their information as described below: For the first object: 1. Ask the user to enter the course number, name and number of credits (the user 2. 3. should enter for example 21541, CS211, and 1 respectively) Create the object using the overloaded constructor (and the data from above) Call the print function to print the object data. For example: Course Number:21541 Course Name: Number of Credits: 1 CS 211 For the second object: 1. Create the object using the default constructor. 2. Call the print function to display the second object's data 3. Prompt the user to enter new data for the second object (for example 21345, CS331, and 3) 4. Call the set function(s) to set the object's attributes to the user input 5. Call the print function to display the new object data Note: You must divide your files into .cpp and .h fileStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started