C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
10th Edition
ISBN: 9780134448848
Author: Paul Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(Package Inheritance Hierarchy) Package-delivery services, such as FedEx® ,DHL®and UPS® ,offer a number of different shipping options, each with specific costsassociated. Create an inheritance hierarchy to represent various types of packages. Useclass Package as the base class of the hierarchy, then include classes TwoDayPackageand OvernightPackage that derive from Package.Base class Package should include data members representing the name, address, city,state and ZIPcode for both these sender and the recipient of the package, in addition todata members that store the weight (in ounces)and cost per ounce to ship the package.Package’s constructor should initialize these data members. Ensure that the weight andcost per ounce contain positive values. Package should provide a public memberfunction calculate Cost that returns a double indicating the cost associated with shippingthe package. Package’s calculate Cost function should determine the cost bymultiplying the weight by the cost per…
(Package Inheritance Hierarchy) Package-delivery services, such as FedEx® ,DHL®and UPS® ,offer a number of different shipping options, each with specific costsassociated. Create an inheritance hierarchy to represent various types of packages. Useclass Package as the base class of the hierarchy, then include classes TwoDayPackageand OvernightPackage that derive from Package.Base class Package should include data members representing the name, address, city,state and ZIPcode for both these sender and the recipient of the package, in addition todata members that store the weight (in ounces)and cost per ounce to ship the package.Package’s constructor should initialize these data members. Ensure that the weight andcost per ounce contain positive values. Package should provide a public memberfunction calculate Cost that returns a double indicating the cost associated with shippingthe package. Package’s calculate Cost function should determine the cost bymultiplying the weight by the cost per…
Programming Assignment #5
Educational Objectives:
After completing this assignment the student should have the following knowledge, ability, and skills:
Define a class hierarchy using inheritance
Define virtual member functions in a class hierarchy
Implement a class hierarchy using inheritance
Implement virtual member functions in a class hierarchy
Use initialization lists to call parent class constructors for derived class constructors
Operational Objectives:
Create (define and implement) a base class Shape classes that will inherit this class called Box, Rectangle, Circle, and Triangle
Description:
Programming Specifications:
You will have a base class of Shape which will have an area and perimeter of type double. You must also create acceptable Gets and Sets for the private data items. All of the other classes will inherit this class.
You will have a class Square which will have just one length of type double. You should create acceptable Gets and Sets for the one…
Chapter 11 Solutions
C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
Ch. 11 - Exercises11.3 (Composition as an Alternative to...Ch. 11 - (Inheritance Advantage) Discuss the ways in which...Ch. 11 - (Protected vs. Private Base Classes) Some...Ch. 11 - Prob. 11.6ECh. 11 - Prob. 11.7ECh. 11 - (Quadrilateral Inheritance Hierarchy) Draw an...Ch. 11 - Package Inheritance Hierarchy} Package-delivery...Ch. 11 - (Account Inheritance Hierarchy) Create an...
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
- Part-2 (Encapsulation, Inheritance, Polymorphism) ____________________________________________________________________________ Create a Java project that demonstrates various object oriented concepts you have learned so far in this course (encapsulation, inheritance and polymorphism). To do this, create a super class and at least 2 subclasses. You can either do multilevel inheritance or hierarchical inheritance in this to complete this part-2 task. The super class will have following properties/functionalities:a) Create a total of 3 member variables for the class, selecting the appropriate data types for each field. b) Include an argument constructor in this Class, that will initialize all data fields. c) Encapsulate this Class.The two subclasses will have below properties/functionalities:a) One of the subclasses will have at least one member variable and other subclass with at least two member variables. b) Have two constructors in each subclass:• One constructor for initializing only…arrow_forwardPart-2 (Encapsulation, Inheritance, Polymorphism) Create a Java project that demonstrates various object oriented concepts you have learned so far in this course (encapsulation, inheritance and polymorphism). To do this, create a super class and at least 2 subclasses. You can either do multilevel inheritance or hierarchical inheritance in this to complete this part-2 task. The super class will have following properties/functionalities: a) Create a total of 3 member variables for the class, selecting the appropriate data types for each field. b) Include an argument constructor in this Class, that will initialize all data fields. c) Encapsulate this Class. The two subclasses will have below properties/functionalities: a) One of the subclasses will have at least one member variable and other subclass with at least two member variables. b) Have two constructors in each subclass: • One constructor for initializing only super class data • Another constructor will initialize both super and…arrow_forward(Package Inheritance Hierarchy) Use the Package inheritance hierarchy created inExercise 19.9 to create a program that displays the address information and calculates the shippingcosts for several Packages. The program should contain a vector of Package pointers to objects ofclasses TwoDayPackage and OvernightPackage. Loop through the vector to process the Packagespolymorphically. For each Package, invoke get functions to obtain the address information of thesender and the recipient, then print the two addresses as they would appear on mailing labels. Also,call each Package’s calculateCost member function and print the result. Keep track of the totalshipping cost for all Packages in the vector, and display this total when the loop terminates.arrow_forward
- Write a class Employee with attributes (employee_id, scale). The class contains member functions to input and show the attributes. Write a child class Manager that inherits Employee class. Child class has attributes of manager id and his depart. It also contains the member functions to input and show its attributesarrow_forwardC++ Please make the necessary changes and finish the code. Objectives• To reinforce previously learned fundamentals• To further apply OOP principles• To understand inheritance betterInstructionsMajor steps outline:1. Implement a BasicShape class, which will be a pure abstract base class2. Implement a Circle class derived from the BasicShape class3. Implement a Recentage class derived from the BasicShape class4. Dynamically create objects of the derived classes (at least 6 objects), and store them in a vector<BasicShape*>5. Iterate through the vector, and call the whatAmI, as well as the getArea method (described later) to ensure the correct areas are calculate for the given shapeImplement a BasicShape classWrite one file:• BasicShape.hThe class is a pure abstract base class, which means all of its methods are pure virtual functions. If you don’t know what this means, please refer to the lecture video as well as the Chapter 11 and 15 material.The pure virtual methods in the…arrow_forwardOverview The objective of this assignment is to demonstrate an ability to implement inheritance, composition, and overloaded operators in a program. This program leverages many of the concepts that you have learned in this class and combines them into a professional-style program. Instructions Classes are getting to be more realistic with each programming assignment. This assignment includes the valuable aspect of inheritance to facilitate reuse of code and operator overloading to allow the usage of familiar operators tailored specifically to the Person, Student, and Faculty classes. Composition is also demonstrated in the use of a Course class that contains objects of the Student and Faculty classes. You are working in the IT department for a university and have been tasked with developing an application that will manage the registration process, which involves the creation of a course, the enrollment of students in the course, and the assignment of faculty members to teach the…arrow_forward
- Problem Statement with Hints 1. Write classes to hold Account, SB - Account and Current - Account details. [Here implement the concept of inheritance.] The common properties of the account are Account number, name and amount. Specifics of SB account is 4% interest to be paid per month. Implement the run - time polymorphism by creating base class variable and derived class object. Ask the user for which type of accou nt to be created then create the corresponding account (Note: Use scanner class). Implement function overriding by having deposit and withdraw functions and perform the required action accordingly. Ensure base class can’t be instantiated. (Note: Abstract k eyword can be used). 2. Define the minimum balance for the both the type of accounts. Use final keyword to create constants. Ensure sb account class and current account class will cannot be used as base classes (Note: You can use final classes).arrow_forwardWrite a class Teacher that contains the attribute teacher name, age and address. It also contains member function to input and display its attributes. Write another class Author that contains the attributes author name, address and number of books written by him. It also contains member functions to input and display its attributes. Write a third class Scholar that inherits both Teacher and Author classes. Test these classes from main() by creating of derived classes and testing functions in a way that clear concept of multiple Inheritance.arrow_forwardlanguage java You have three classes for each type of products. It is time to think about how to improve the data model – all three types have enough in common to be child classes of one parent class. Thus, the first thing to do is create a superclass and make three product type classes subclasses. Then, move as many members (fields and methods) from Type X, Y, and Z product classes to a superclass as possible. Change the constructors appropriately. The advantage of inheritance is the ability to create an array of superclass objects to be filled with objects of different subclasses. Thus, your inventory is in one array. Use the product’s index in the array to build the product’s ID (I would recommend starting with 1). In the superclass, create a static variable that holds the number of products available in the inventory. It must grow as reading from the file progresses.Override a default toString() method for a superclass such that it shows product ID, name, regular price, and…arrow_forward
- Use C++. Add 3 data members to parent class and 2 to child class to implement inheritance. Data members should be in classes. Parameterized constructor needed for parent class. Child class constructor values are needed by parent class constructor. Show the console data of a child class object.arrow_forwardwrite a code using opp (c++). using constructors, destructors ,Inheritance Write program to perform Student Management Tasks similar to CU Online It should have related concepts implementation such as Constructors, Destructors, Inheritance etcarrow_forwardC#(Sharp): In an inheritance relationship, the ________________ is the general class Base class Master class Derived class Parent classarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
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
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