Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE WRITE IN C++ LANGUAGE For output: please comment and show results for both codes seperately For Part1: you must divide files .cpp and .h

PLEASE WRITE IN C++ LANGUAGE

image text in transcribed

image text in transcribed

For output: please comment and show results for both codes seperately

For Part1: you must divide files .cpp and .h

must contain own main.cpp code

show results and comments

For Part 2:

You must divide your files into .cpp and .h file.

Part two must have its own main.cpp file or label it main2.cpp

Must have 2 h files (Course and Instructor h)

Note: You will have a total of two .h files (Course.h and Instructor.h) and three .cpp files (Course.cpp, Instructor.cpp, and main.cpp).

Must displays comments and results

Lab 4 Due Date: Sep 26, 2018 Total Points: 15 points The purpose of this lab is to practice working with basic and aggregate or composite classes. 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 obiect: 1. Ask the user to enter the course number, name and number of credits (the user should enter for example 21541, CS211, and 1 respectively 2. Create the object using the overloaded constructor (and the data from above) 3. Call the print function to print the object data. For example: Course Number: Course Name Number of Credits 1 21541 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 file Part 2: In this part, you will design aggregate classes to record personal and academic information about instructors at a university. The classes are: Instructor, and Course (from Program 1) All class attributes must be private and accessed through public member functions 1. You need to write appropriate constructor (default and overloaded), accessor (print and get if necessary) and mutator (set) functions for each class. The attributes of each class are summarized below: Instructor class contains personal and academic information. You may assume every instructor teaches 3 courses. Instructor class has the following private attributes string string char ong string Course firstName lastName gender (M' for Male and 'F' for Female) empoyeeID officeNum courses[3] Course class contains individual course information and has the following private attributes long courseNumber courseName numberOfCredits 2. After you design your classes, write a main program that instantiates 2 instructor objects and displays their information: For the first obiect: 1. use the overloaded constructor to create an instructor object and initialize its attributes to the following Mayssaa Najjar F 2390876 ACD324 21540 CS211 3 21541 CS211 1 21345 CS331 3 2. Then call the print function to display the instructor object's data For the second object, 1. use the default constructor to create an instructor object 2. call the print function to display the instructor's data 3. call the instructor set function to change the object's attributes to the following - Michelle James F 2390878 SBSB3024 24540 CS111 3 24541 CS111 1 22275 CS351 4. call the instructor print function to display the new object's data. Note: You will have a total of two .h files (Course.h and Instructor.h) and three .cpp files (Course.cpp, Instructor.cpp, and main.cpp)

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

Explain why a total return swap can be useful as a financing tool.

Answered: 1 week ago