Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 15, Problem 2PP

Create a base class called Vehicle that has the manufacturer’s name (type string), number of cylinders in the engine (type int), and owner (type Person, given below). Then create a class called Truck that is derived from Vehicle and has additional properties: the load capacity in tons (type double since it may contain a fractional part) and towing capacity in pounds (type int). Be sure your classes have a reasonable complement of constructors, accessor, and mutator member functions, an overloaded assignmentoperator, and a copy constructor. Write a driver program that tests all your member functions.

The definition of the class Person follows. The implementation of the classis part of this Programming Project.

class Person

{

public:

Person();

Person(string theName);

Person(const Person& theObject);

string getName() const;

Person& operator = (const Person& rtSide);

friend istream& operator >>(istream& inStream,

Person& personObject);

friend ostream& operator <<(ostream& outStream,

const Person& personObject);

private:

string name;

};

Blurred answer
Students have asked these similar questions
Define a class named Employee. This class should extend the Person class from the previous question. The class should have a constructor, which takes the name, age, employer (String) and salary (int) as parameters (in that order). The first two parameters should be passed to the constructor of the superclass and the value of the last two parameters should be stored in instance variables. The class should define the methods, getSalary which returns the salary of the employee and getEmployer which returns the name of the employer. Any methods from the previous question that need to be overridden should be overridden! Use super and instanceof as appropriate. I.e., for the following methods you should be able to call the method in the superclass for specific situations (e.g. the compareTo method in the superclass can be called if you receive anything other than an Employee, and this also holds for the equals method). The toString method only needs to append details and as such can also…
Every employee in a firm XYZ has attributes employeeid, name and salary.   However the sales employees in firm XYZ has all the attributes of employees and also has an additional attribute named bonus.   You are a software developer who has to the implement the relation between employee and sales employee.   Write the code for classes employee and employee_sales. Write the constructors for both classes that set the attributes of both classes.
Take the following code snippets (see below) and put them into a class called Employee. Then create two concrete (non-abstract) classes: Cashier and Supervisor Set the base salary of cashiers to be $30,000. Set the base salaries of supervisors to be $60,000. (use their constructors to do this). Create different methods for getMontlySalary() for the Cashier and Supervisor classes. a) for the Cashier class, just divide the basic salary by 12 to get the monthly. b) for the Supervisor class, also add a 10% bonus. So a supervisor before any  raises would earn $5500 per month. (60,000/12 + 10%) Create an employee tester class. Add an array of 10 employees. put 8 cashiers and 2 supervisors into the array. Print out the complete records of all 10 employees using a for loop. (Hint: Overload the toString() on all Employee class). abstract class Employee {private String name, address; private int basicSalary;public String getName(){ return name; }public String getAddress(){ return address;…

Chapter 15 Solutions

Problem Solving with C++ (9th Edition)

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
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