Some of the characteristics of a book are the title, author(s), publisher, ISBN, price, and year of publication. Design a class bookType that defines the book as an ADT.
Each object of the class bookType can hold the following information about a book: title, up to four authors, publisher, ISBN, price, and number of copies in stock. To keep track of the number of authors, add another member variable.
Include the member functions to perform the various operations on objects of type bookType. For example, the usual operations that can be performed on the title are to show the title, set the title, and check whether a title is the same as the actual title of the book. Similarly, the typical operations that can be performed on the number of copies in stock are to show the number of copies in stock, set the number of copies in stock, update the number of copies in stock, and return the number of copies in stock. Add similar operations for the publisher, ISBN, book price, and authors. Add the appropriate constructors and a destructor (if one is needed).
Write the definitions of the member functions of the class bookType.
Write a
program that uses the class bookType and tests various operations on the objects of the class bookType. Declare an array of 100 components of type bookType. Some of the operations that you should perform are to search for a book by its title, search by ISBN, and update the number of copies of a book.
Trending nowThis is a popular solution!
Chapter 10 Solutions
C++ Programming: From Problem Analysis to Program Design
- 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. 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_forwardChapter 10 defined the class circleType to implement the basic properties of a circle. (Add the function print to this class to output the radius, area, and circumference of a circle.) Now every cylinder has a base and height, where the base is a circle. Design a class cylinderType that can capture the properties of a cylinder and perform the usual operations on the cylinder. Derive this class from the class circleType designed in Chapter 10. Some of the operations that can be performed on a cylinder are as follows: calculate and print the volume, calculate and print the surface area, set the height, set the radius of the base, and set the center of the base. Also, write a program to test various operations on a cylinder.arrow_forwardIn this exercise , you will design various classes and write a program to computerize the billingsystem of a hospital.a. Create a personType class with first name and last name as data menbers. Add appropriateconstructors and member functions to initialize, access, and manipulate the data members.Design the class doctorType, inherited from the class personType, with an additional data memberto store a doctor’s speciality. Add appropriate constructors and member functions 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 hospitalcharges, such as pharmacy charges for medicine, doctor’s fee, and room charges. Add appropriate constructors and member functions to initialize, access, and manipulate the data members.c. Design the class patientType, inherited from the class personType, with additional data membersto store a patient’s ID, age, date of birth, attending physician’s name, the date when the…arrow_forward
- Write a class called Bicycle, which contains two attributes, gear, which describes the type of gear the bicycle has, and speed, the max speed the bicycle can reach. Write a class called MountainBike which inherits Bicycle and has one extra attribute, which is the seatHeight. Write a main function in which define an object of type MountainBike that has a manual gear, speed of 20, and seat height of 10. Then print the object status.arrow_forwardIn this exercise, you will design a class memberType.a. Each object of memberType can hold the name of a person, member ID, number of books bought, and amount spent.b. 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, update, modify, and show the number of books bought and the amount spent.c. Add the appropriate constructors.d. Write the definitions of the member functions of memberType.e. Write a program to test various operations of your class memberTypearrow_forwardIn 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…arrow_forward
- 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…arrow_forwardCreate an enum that holds three employee types, i.e. fixed, permanent and temporary. Create an Employee class and include the enum created in Step 1 as one of the fields within the class. Include as other fields data such as employee number, name and identity number. Using the information from Steps 1 and 2, develop a Java program that includes code that makes use of the enum to print out each employee’s data indicating whether they are fixed, permanent, or temporary appointments. Include other details (as seen as part of the Employee class). Briefly describe how you structured your array. Motivate why you did it like this. Explain the Java statements that you used to structure your enum.arrow_forwardUsing classes, design an online address book to keep track of the names, addresses, phone numbers,and dates of birth of family members, close friends, and certain business associates. Your program shouldbe able to handle a maximum of 500 entries.a. Define a class, addressType, that can store a street address, city, state, and ZIP code. Use theappropriate functions to print and store the address. Also, use constructors to automaticallyinitialize the member variables.b. Define a class extPersonType , the class personType, the class dateType (as designed in Q1), andthe class addressType. Add a member variable to this class to classify the person as a familymember, friend, or business associate. Also, add a member variable to store the phone number.Add (or override) the functions to print and store the appropriate information. Use constructors toautomatically initialize the member variables.c. Define the class addressBookType using the previously defined classes. An object of the…arrow_forward
- Write a Fraction class whose objects will represent fractions. Note: this is the first part of a multi-part assignment. For this week (1) do not reduce fractions, (2) do not use "const," (3) do not provide any constructors, and (4) do not use three separate files. These are topics we will study next week. You will not receive credit for the assignment if you do any of these things. In your single file, the class declaration will come first, followed by the definitions of the class member functions, followed by the client program. You must provide the following member functions: A set() operation that takes two integer arguments, a numerator and a denominator, and sets the calling object accordingly. Arithmetic operations that add, subtract, multiply, and divide Fractions. These should be implemented as value returning functions that return a Fraction object. They should be named addedTo, subtract, multipliedBy, and dividedBy. In these functions you will need to declare a local…arrow_forwardWrite a Fraction class whose objects will represent fractions. Note: this is the first part of a multi-part assignment. For this week (1) do not reduce fractions, (2) do not use "const," (3) do not provide any constructors, and (4) do not use three separate files. These are topics we will study next week. You will not receive credit for the assignment if you do any of these things. In your single file, the class declaration will come first, followed by the definitions of the class member functions, followed by the client program. You must provide the following member functions: A set() operation that takes two integer arguments, a numerator and a denominator, and sets the calling object accordingly. Arithmetic operations that add, subtract, multiply, and divide Fractions. These should be implemented as value returning functions that return a Fraction object. They should be named addedTo, subtract, multipliedBy, and dividedBy. In these functions you will need to declare a local…arrow_forwardWrite a Fraction class whose objects will represent fractions. Note: this is the first part of a multi-part assignment. For this week (1) do not reduce fractions, (2) do not use "const," (3) do not provide any constructors, and (4) do not use three separate files. These are topics we will study next week. You will not receive credit for the assignment if you do any of these things. In your single file, the class declaration will come first, followed by the definitions of the class member functions, followed by the client program. You must provide the following member functions: A set() operation that takes two integer arguments, a numerator and a denominator, and sets the calling object accordingly. Arithmetic operations that add, subtract, multiply, and divide Fractions. These should be implemented as value returning functions that return a Fraction object. They should be named addedTo, subtract, multipliedBy, and dividedBy. In these functions you will need to declare a local…arrow_forward
- 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,