Need help on c++
Sample input:
Project description: In this assignment you will create a class representing a ship, and two additional classes that inherit from the Ship class, a CargoShip class and a CruiseShip class. The project is geared toward giving 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 class .Files must be named ship.h and ship.cpp Class must be named Ship Must contain #include guards for 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. iii. iv. A two parameter constructor that takes the ship's name and fuel load (in that order) A parameterless void function, fuel, that outputs the ship's name and its fuel load (see sample output) A virtual void function, sail, that prints the ship's name followed by the word "sailing" (see output) A pure-virtual void function, load, that has a single integer parameter, and simulates loading 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 i. A five parameter constructor that takes the ship's name, fuel load, and the percentages of passengers in Luxury, Upper Deck, and Lower Deck (in that order)- The percentages must sum to 1-This constructor must pass parameters to the constructor in the base class A void function, sail, that overrides the virtual function in the base class, and prints the ship's name and the number of passengers in Luxury, Upper Deck, and Lower Deck, in that order (see output) ii. iL A void function, load, that overrides/implements the pure virtual function in the base class, accepts an integer representing the number of passengers as a parameter, and distributes those passengers among the three cabin levels (Luxury, Upper Deck, Lower Deck) per the percentages specified c) The CargoShip class- This is a derived dass that inherits from the Ship class as public Files must be named cargoship.h and cargoship.cpp Class must be named CargoShip Must contain #include guards for CARGOSHIPH . . .Will have these private members i. li. iiL Two double pointer variables to represent tonnage in the forward cargo bay and the aft cargo bay An integer that indicates the maximum total cargo capacity for the ship (in tons) A double for the decimal percentage of cargo that is loaded in the forward bay Must have these public members . i. A four parameter constructor that takes the ship's name, fuel load, cargo capacity, and forward bay percentage (in that order) This constructor must pass parameters to the base class constructor and should dynamically allocate the memory to represent the cargo bays and initialize them to zero ii. A destructor that frees the memory allocated for the cargo bays ii A void function, fuel, that overloads the function in the base class, and has an integer parameter that represents the fuel flashpoint- This function calls the fuel function in the base class, and also outputs its integer parameter, without any error checking or processing (see sample output) A void function, lood, that overrides/implements the pure virtual function in the base class, accepts an integer representing the tons of cargo to be loaded on the ship- A check must be made to ensure that the ship is only loaded up to its capacity (if an overload is attempted, simply load to the maximum capacity - do not output an error message) This function should place a percentage of the cargo in the forward bay (as specified in the input file) and the remainder in the aft bay, and should output the forward bay load and the aft bay load unformatted, in that order, on a single line (see sample output) iv. c) A driver, or client, file Must be named proj3.cpp Must have two functions as shown below-main must be defined first . o sailShip-This void function simulates the ship getting underway with a single function call It has a single parameter: a reference to a Ship object It invokes the sail function through this object o main-This function performs - Must be defined first - Opens and reads an input file named ships.txt, in this format (see sample input file): .Line 1: Information about a cruise ship, in this order: ship name (a single word) fuel load (double): Luxury percentage; Upper Deck percentage; and Lower Deck percentage (these 3 decimal percentages are doubles and must sum to 1): and the number of passengers to load (integer) .Line 2: Information about a cargo ship, in this order: ship name (a single word): fuel load (double): Total Cargo capacity (integer); Forward Cargo Bay percentage (a double) (Note: the Aft Cargo Bay will hold 1 minus the Forward Bay percentage); cargo tonnage to load (integer); and Fuel flashpoint (integer) Instantiates a CruiseShip object with the information from the input file, and invokes its fuel, and load functions, and the sailShip function (with the CruiseShip object as an argument) - Instantiates a CargoShip object and invokes its fuel, and load functions, and the sailShip function (with the CargoShip object as an argument) 2. Sample output (based on sample input file provided with this assignment)- Your output must match. Do not add additional verbiage, or change line spacing or character spacing (do not use tabs- only a single space between items): alypso 450 alypso 600 1000 2400 Hauler 725 auler 46 Hauler 296 504 auler sailing Calypso 450 0.15 0.25 0.6 4000 Hauler 725 800 0.37 1000 46