Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: 1) Use inheritance to derive new dasses; 2) Understand abstract base classes; 3) Overload base class functions; 4) Override base class virtual functions; 5)

image text in transcribed
image text in transcribed
Objectives: 1) Use inheritance to derive new dasses; 2) Understand abstract base classes; 3) Overload base class functions; 4) Override base class virtual functions; 5) Define pure virtual functions; 6) Understand static and dynamic function call binding: 7) Use custom destructors to free dynamically allocated memory Project description: In this assignment you will create a class representing a ship, and create two additional dasses that inherit from the Ship class, a CargoShip class and a CruiseShip dass. The project is geared to give you practical experience with characteristics and C++ implementation details of inheritance and polymorphism. Requirements 1. Your program must be split into 7 files. There will be 3 classes (each with separate interface and implementation files), and a driver file. The requirements for these are specified below a) The Ship class-This is an abstract dass .Files must be named ship.h and ship.opp .Class must be named Ship Must contain#include guardsfor SHIP-H .Will have these protected members i. A string containing the ship's name A double representing the amount of fuel on board (in tons) ii. Must have these public members i. ii. ili. iv. A two parameter constructor that takes the ship's name and fuel load (in that order) A void function, fuel, that outputs the ship's name and its fuel load (see sample output) A virtual void function, sail, that prints a generic message indicating that the ship is underway A pure-virtual void function, load, that loads the ship with tonnage (cargo) or passengers (cruise) b) The CruiseShip class-This is a derived class that inherits from the Ship class as public Files must be named cruiseship.h and cruiseship.cpp .Class must be named CruiseShip * Must contain#include guards for CRUISESHIPH Will have these private members i. Three doubles that indicate the percentage of passengers in Luxury, Upper Deck, and Lower Deck cabins respectively. These values must sum to 1 Three integers that indicate the number of passengers in Luxury, Upper Deck, and Lower Deck cabins respectively ii. .Must have these public members

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions