Programming Assignment #2 Building Classes Using Inheritance In this assignment you will be building classes like in ass
Posted: Mon Jun 06, 2022 6:06 pm
Programming Assignment #2 Building Classes Using Inheritance In
this assignment you will be building classes like in assignment #1,
but with inheritance and excepon handling. You will also test your
class funconality with a main() driver program. You will
create a class hierarchy that we will use later. This hierarchy
will use inheritance and virtual funcons. Below is class hierarchy
diagram and below the diagram there are details for each class.
Constructors and Operators Constructors: For each class, the
default and parameterized constructors should be implemented and
have appropriate error detecon. For the parameterized constructor,
order your parameters as listed above. Operators: The
<<, >>, and == operators should be overloaded for each
class. Below are the specific requirements for each class.
Please use this as your reference for implemenng the class
hierarchy. Vehicle Class Create a class named Vehicle with
the following aributes and methods: Aributes noOfWheels: The number
of wheels on the vehicle color: The color of the vehicle
licensePlate: A license plate number Methods Base Access Methods:
All geers (accessors) and seers (modifiers). Your seers should have
appropriate error detecon. All accessors should start with “get”
and all modifiers should start with “set” and then followed by the
name of aribute using camel case. For example, the accessors and
modifiers for the noOfWheels aribute should be: getNoOfWheels
setNoOfWheels Note: camel-case will require first leer of the
aribute to capitalized. void park() : A pure virtual method that
will be implemented within the child classes PassengerVehicle Class
Create a class named PassengerVehicle that inherits the Vehicle
class with the following aributes and methods: Aributes
passengerSeats: The number of seats in the vehicle Methods Base
Access Methods: All geers (accessors) and seers (modifiers). Your
seers should have appropriate error detecon. All accessors should
start with “get” and all modifiers should start with “set” and then
followed by the name of aribute using camel case.
CargoVehicle Class Create a class named CargoVehicle that
inherits the Vehicle class with the following aributes and methods:
Aributes noOfDoors: The number of doors on the vehicle
loadCapacity: The maximum weight (lbs) that the vehicle can support
Methods Base Access Methods: All geers (accessors) and seers
(modifiers). Your seers should have appropriate error detecon. All
accessors should start with “get” and all modifiers should start
with “set” and then followed by the name of aribute using camel
case. Car Class Create a class named Car that inherits the
PassengerVehicle class with the following aributes and methods:
Aributes noOfDoors: The number of doors on the vehicle Methods Base
Access Methods: All geers (accessors) and seers (modifiers). Your
seers should have appropriate error detecon. All accessors should
start with “get” and all modifiers should start with “set” and then
followed by the name of aribute using camel case. void
park(): This method will be fully implemented later. But for now it
should output “Parking Car” Motorcycle Class Create a class named
Motorcycle that inherits the PassengerVehicle class with the
following aributes and methods: Aributes seatHeight: The height of
the cycle’s seat from the ground () Methods Base Access Methods:
All geers (accessors) and seers (modifiers). Your seers should have
appropriate error detecon. All accessors should start with “get”
and all modifiers should start with “set” and then followed by the
name of aribute using camel case. void park(): This method
will be fully implemented later. But for now it should output
“Parking Motorcycle” Van Class Create a class named Van that
inherits the CargoVehicle class with the following aributes and
methods: Aributes noOfBoxes: The number of 2x2x2 boxes can
fit on the van Methods Base Access Methods: All geers (accessors)
and seers (modifiers). Your seers should have appropriate error
detecon. All accessors should start with “get” and all modifiers
should start with “set” and then followed by the name of aribute
using camel case. void park(): This method will be fully
implemented later. But for now it should output “Parking Van” Truck
Class Create a class named Truck that inherits the CargoVehicle
class with the following aributes and methods: Aributes
SizeOfContainer: The size of the container that can be carried by
the Truck (cubic ) Methods Base Access Methods: All geers
(accessors) and seers (modifiers). Your seers should have
appropriate error detecon. All accessors should start with “get”
and all modifiers should start with “set” and then followed by the
name of aribute using camel case. void park(): This method
will be fully implemented later. But for now it should output
“Parking Van” Build a main() driver and test your classes as you
have done before. Keep in mind that you need to tests each of the
leaf classes. NOTE: You should not be able to create any objects of
the toplevel classes. You may find it useful to create
funcons that can be reused to perform certain types of tests like
the modifier and accessor tests. Your main will be a series
of test code that hopefully calls helper funcons and just has
inlined code. Try to test every aspect of your classes and if
you have quesons about any tests, then post to the forum. Your
output should be a series of clear messages of “Passing” tests. If
a test fails that is fine, submit with the failed test and ask in
the forum why your test may be failing. Either way can be a
learning experience.
this assignment you will be building classes like in assignment #1,
but with inheritance and excepon handling. You will also test your
class funconality with a main() driver program. You will
create a class hierarchy that we will use later. This hierarchy
will use inheritance and virtual funcons. Below is class hierarchy
diagram and below the diagram there are details for each class.
Constructors and Operators Constructors: For each class, the
default and parameterized constructors should be implemented and
have appropriate error detecon. For the parameterized constructor,
order your parameters as listed above. Operators: The
<<, >>, and == operators should be overloaded for each
class. Below are the specific requirements for each class.
Please use this as your reference for implemenng the class
hierarchy. Vehicle Class Create a class named Vehicle with
the following aributes and methods: Aributes noOfWheels: The number
of wheels on the vehicle color: The color of the vehicle
licensePlate: A license plate number Methods Base Access Methods:
All geers (accessors) and seers (modifiers). Your seers should have
appropriate error detecon. All accessors should start with “get”
and all modifiers should start with “set” and then followed by the
name of aribute using camel case. For example, the accessors and
modifiers for the noOfWheels aribute should be: getNoOfWheels
setNoOfWheels Note: camel-case will require first leer of the
aribute to capitalized. void park() : A pure virtual method that
will be implemented within the child classes PassengerVehicle Class
Create a class named PassengerVehicle that inherits the Vehicle
class with the following aributes and methods: Aributes
passengerSeats: The number of seats in the vehicle Methods Base
Access Methods: All geers (accessors) and seers (modifiers). Your
seers should have appropriate error detecon. All accessors should
start with “get” and all modifiers should start with “set” and then
followed by the name of aribute using camel case.
CargoVehicle Class Create a class named CargoVehicle that
inherits the Vehicle class with the following aributes and methods:
Aributes noOfDoors: The number of doors on the vehicle
loadCapacity: The maximum weight (lbs) that the vehicle can support
Methods Base Access Methods: All geers (accessors) and seers
(modifiers). Your seers should have appropriate error detecon. All
accessors should start with “get” and all modifiers should start
with “set” and then followed by the name of aribute using camel
case. Car Class Create a class named Car that inherits the
PassengerVehicle class with the following aributes and methods:
Aributes noOfDoors: The number of doors on the vehicle Methods Base
Access Methods: All geers (accessors) and seers (modifiers). Your
seers should have appropriate error detecon. All accessors should
start with “get” and all modifiers should start with “set” and then
followed by the name of aribute using camel case. void
park(): This method will be fully implemented later. But for now it
should output “Parking Car” Motorcycle Class Create a class named
Motorcycle that inherits the PassengerVehicle class with the
following aributes and methods: Aributes seatHeight: The height of
the cycle’s seat from the ground () Methods Base Access Methods:
All geers (accessors) and seers (modifiers). Your seers should have
appropriate error detecon. All accessors should start with “get”
and all modifiers should start with “set” and then followed by the
name of aribute using camel case. void park(): This method
will be fully implemented later. But for now it should output
“Parking Motorcycle” Van Class Create a class named Van that
inherits the CargoVehicle class with the following aributes and
methods: Aributes noOfBoxes: The number of 2x2x2 boxes can
fit on the van Methods Base Access Methods: All geers (accessors)
and seers (modifiers). Your seers should have appropriate error
detecon. All accessors should start with “get” and all modifiers
should start with “set” and then followed by the name of aribute
using camel case. void park(): This method will be fully
implemented later. But for now it should output “Parking Van” Truck
Class Create a class named Truck that inherits the CargoVehicle
class with the following aributes and methods: Aributes
SizeOfContainer: The size of the container that can be carried by
the Truck (cubic ) Methods Base Access Methods: All geers
(accessors) and seers (modifiers). Your seers should have
appropriate error detecon. All accessors should start with “get”
and all modifiers should start with “set” and then followed by the
name of aribute using camel case. void park(): This method
will be fully implemented later. But for now it should output
“Parking Van” Build a main() driver and test your classes as you
have done before. Keep in mind that you need to tests each of the
leaf classes. NOTE: You should not be able to create any objects of
the toplevel classes. You may find it useful to create
funcons that can be reused to perform certain types of tests like
the modifier and accessor tests. Your main will be a series
of test code that hopefully calls helper funcons and just has
inlined code. Try to test every aspect of your classes and if
you have quesons about any tests, then post to the forum. Your
output should be a series of clear messages of “Passing” tests. If
a test fails that is fine, submit with the failed test and ask in
the forum why your test may be failing. Either way can be a
learning experience.