Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For Part1: you must divide files .cpp and .h must contain own main.cpp code For Part 2: You must divide your files into .cpp and

image text in transcribed

image text in transcribed

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

must contain own main.cpp code

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).

This program should be in c++ and use basic techniques of objects and classes since i'm barely learning them.

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 course Number string courseName numberOfCredits All class attributes must be private and accessed through public member functions. int You need to write the following public methods: - - - - Default constructor that sets course Number to 0, courseName to ", and number of Credits 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 should enter for example 21541, CS211, and I 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: 21541 CS 211 1 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 first Name string lastName char gender ('M' for Male and 'F' for Female) empoyeeID string officeNum Course courses[3] long Course class contains individual course information and has the following private attributes: long course Number string course Name int numberOfCredits 2. After you design your classes, write a main program that instantiates 2 instructor objects and displays their information: - For the first object: 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_2

Step: 3

blur-text-image_3

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

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

3030871002, 978-3030871000

More Books

Students also viewed these Databases questions

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago