C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
thumb_up100%
Chapter 11, Problem 1PE
In Chapter 10, the class clockType was designed to implement the time of day in a
Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors. Finally, write a test program to test your class.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone. Derive the class extClockType from the class clockType by adding a member variable to store the time zone called timeZone. Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors. Finally, write a test program to test your class.
Codes Given: clockType.h & clockTypelmp.cpp
clockType.h
//clockType.h, the specification file for the class clockType
#ifndef H_ClockType
#define H_ClockType
class clockType
{
public:
void setTime(int hours, int minutes, int seconds);
//Function to set the time.
//The time is set according to the parameters.
//Postcondition: hr = hours; min = minutes;
// sec = seconds
// The function checks whether…
In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone. Derive the class extClockType from the class clockType by adding a member variable to store the time zone called timeZone. Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors. Finally, write a test program to test your class.
//clockType.h, the specification file for the class clockType
#ifndef H_ClockType
#define H_ClockType
class clockType
{
public:
void setTime(int hours, int minutes, int seconds);
//Function to set the time.
//The time is set according to the parameters.
//Postcondition: hr = hours; min = minutes;
// sec = seconds
// The function checks whether the values of
// hours, minutes, and seconds are…
In Chapter 10, the class clockTypewas designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone. Derive the class extClockType from the class clockType by adding a member variable to store the time zone called timeZone. Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors. Finally, write a test program to test your class.
Chapter 11 Solutions
C++ Programming: From Problem Analysis to Program Design
Ch. 11 -
Mark the following statements as true or...Ch. 11 -
Suppose animal is a class that defines the basic...Ch. 11 - Suppose that a class employeeType is derived from...Ch. 11 - Consider the class circleType as defined in...Ch. 11 - Consider the following statements:...Ch. 11 - Consider the following statements: class twoStory:...Ch. 11 - Prob. 7SACh. 11 - Suppose that you have the declarations of Exercise...Ch. 11 - Prob. 9SACh. 11 - Assume the definition of the classes employee and...
Ch. 11 -
Consider the following class definitions: (2,...Ch. 11 - In Chapter 10, the class clockType was designed to...Ch. 11 -
In this chapter, the class dateType was designed...Ch. 11 - Chapter 10 defined the class circleType to...Ch. 11 - Amanda and Tyler opened a business that...Ch. 11 - Using classes, design an online address book to...Ch. 11 - Define the class bankAccount to store a bank...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- a. Instance of a class is called, functions have same name but different sets of parameters.arrow_forwardIn C++, Create a class called Date that includes three data members: amonth(type int), a day(type int), and a year(type int). The Date class willhave a constructor with three parameters to initialize the three data members.You may assume the values provided for the year and day are correct, but makesure that the month value is in the range 1-12; if it isn't, set the month to1. Provide set and get functions for each data member. Provide a memberfunction displayDate that displays the date in format MM/DD/YYYY.Write a test program that prompts the user to input the month, the day,and the year and uses your Date class to output the formatted date.arrow_forwardIn C++ The class clockType was designed to implement the time of dayin a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone. Derive the class extClockType from the class clockType by adding a member variable to store the time zone. Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors.Finally, write a test program to test your class.arrow_forward
- In this exercise, you will design various classes and write a program to computerize the billing system of a hospital.a. Design the class doctorType, inherited from the class personType, with an additional data member to store a doctor’s speciality. Add appropriate constructors and member func- tions to initialize, access, and manipulate the data members.b. Design the class billType with data members to store a patient’s ID and a patient’s hospital charges, such as pharmacy charges for medicine, doctor’s fee, and room charges. Add appropriate construc- tors and member functions to initialize, access, and manipulate the data members.c. Design the class patientType, inherited from the class personType, with additional data members to store a patient’s ID, age, date of birth, attending physician’s name, the date when the patient was admitted in the hospital, and the date when the patient was discharged from the hospital. (Use the class dateType to store the date of birth, admit date,…arrow_forwardI have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?arrow_forwardComplete the code for the following program. You are provided with an abstract class called abst. Create a class that will be a child of abst and it will be called usesAbst. Your program will have an int variable called value, and all the appropriate methods, as well 2 constructors. The first constructor will simply set the variable value to 0. The second constructor will set the variable value to equal a passed in parameter. You do not have to comment your code. public abstract class abst{ public abst () { } //Outputs to the screen the message Hello public abstract void sayHello (); //returns the stored int value public abstract int getValue (); //sets the int value to x public abstract void setValue (int x); //Outputs to the screen the message Another method public void output () { System.out.println("Another method"); public String tostring () { return "This is an abstract class"; }arrow_forward
- C++ In this exercise, you will design the class memberType. Each object of memberType can hold the name of a person, member ID, number of books bought, and amount spent. Include the member functions to perform the various operations on the objects of memberType—for example, modify, set, and show a person’s name. Similarly, up-date, modify, and show the number of books bought and the amount spent. Add the appropriate constructors. Write the definitions of the member functions of memberType. Write a program to test various operations of your class memberType. Please look at photos, there are multiple tabs to write code in and a document to pull text from.arrow_forwardWrite a class ‘Box’ which has three members height, width and depth; To set values and use these members, write mutator and accessor functions for these members. (Hint: there would be 3 Accessor and 3 Mutator functions).arrow_forwardWrite a program to create a class teacher with the following data members.ID: Can be accessed only from the teacher class and derived classes of the teacher.Age: Can be accessed from all the classes and packages in the application.Phone Number: Can be accessed only from the classes inside the same package.Write the constructor function. Derive a class Math_teacher from the teacher class, add the following two data members in the Math_teacher class.Room Number: This can be accessed by all the classes in the application.Course_ID: This can be accessed by all the classes in the same package.Write the constructor function.arrow_forward
- Create a class called Employee that includes three pieces of information as data members—a first name (type string), a last name (type string) and a monthly salary (type int). Your class should have a constructor that initializes the three data members. Provide a set and a get function for each data member. If the monthly salary is not positive, set it to 0. Write a test program that demonstrates class Employee’s capabilities. Create two Employee objects and display each object’s yearly salary. Then give each Employee a 10 percent raise and display each Employee’s yearly salary again.arrow_forwardHello, I need help with finding and correcting al the syntax and/or logical errorsarrow_forwardCreate a class called Rational to be able to perform arithmetic operations with fractions. testing your class and Write a program that presents a menu to the user to perform the desired action. User enters -1 value You can trade as much as you want. Use integer variables to represent the private data members (numerator and denominator) of the class. to this class Write a constructor function that initializes an object of the property as soon as it is declared. Constructive the function must contain default values for cases where no initial values are given and use the fractional number should store it in reduced form (i.e. the fraction 2/4 should be reduced to 1 for the numerator and 2 for the denominator). Provide public member functions for each of the following: ‐ The sum of two fractions - Subtraction of two fractions ‐ Multiplication of two fractions ‐ The division of two fractions In all of the above functions, results must be stored in a reduced form. Also, write the…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY