Starting from:
$30

$24

Lab 06 Solution

Objectives:




Classes and Data Abstraction



User-defined classes



Implementation of a class in separate files









Question 1:




Chapter 10 defines class clockType to implement time in a program. The class includes functions named “setTime(int hours, int minutes, int seconds)” and “getTime(int& hours, int& minutes, int& seconds) const” in order to set and get clock time, respectively. Modify the class by adding six additional functions (setHours, setMinutes, setSeconds, getHours, getMinutes, and getSeconds) so that the users can set/get hours, minutes, or seconds separately. Also modify the main function to make sure your code provides the same output as follows:




Question 2:




Design a new class named memberType. Each object of memberType can hold the name of a person, member ID, and number of books bought. Include member functions to perform atleast the following operations on the objects of memberType: create a new member, modify name, show name, modify member ID, show member ID, modify number of books bought and show number of books bought. Add the appropriate constructors. Write the definitions of the member functions of memberType. Make sure your code provides the same output as follows:










You can download the class files from blackboard.




Submission guideline:




You MUST follow the submission guideline. Otherwise you will lose points.



Your submission folder structure should be:



LastnameFirstnameLabX.zip

program1



clockType.h



clockTypeImp.cpp



MainProgram.cpp
program2



MainProgram.h



memberType.cpp



memberType.h

More products