Represent a hypothetical car production line

Assignment Help Other Subject
Reference no: EM132233436

Question: Overview: The purpose of this assignment is to give you some experience writing classes in C++, including utilizing accessors and constructors to organize data properly.

Description: This program will represent a hypothetical car production line, which consists of a chassis (body of a vehicle) and wheels. These two components will be used to make fully functioning vehicles (just use your imagination). To that end, there are three classes you will be writing:

• Vehicle

• Chassis

• Wheel

For this assignment, main.cpp will be provided for you, so you don't have to worry about the structure of the program. Instead, you can focus solely on the structure of the classes and their interactions. I suggest looking at main closely, to help you understand the structure of the project. Chassis The Chassis class is the backbone of your vehicle. You will need to store the following data:

• The size of the chassis (small, medium, large)

• The quality of the chassis (poor, fair, good)

• The number of wheels it can support The number of wheels a given chassis can support is dependent on the size of the vehicle. If the vehicle is small, it functions with 3 wheels (the tri-wheeled wonder).

If it is medium, 4 wheels are required. If the vehicle is large, you will need to have 6 wheels. The default constructor for the chassis will insure it is a medium sized chassis of fair quality. You will also need to implement two more constructors, one that will allow you to specify a size for the chassis, and one that will allow you to specify a size and quality for the chassis. Finally, you will need a getter method for the number of wheels called getNumWheels(). Wheels Your Wheel class should contain variables for the following:

• Mileage Left

• Condition the wheel is in (poor, fair, good) The default condition for Wheels made will be fair. A fair wheel will have 10,000 miles available to it at the start. A good wheel will have 20,000 and a poor wheel will start with 5,000. You will once again need a default constructor and a second constructor that overrides the condition of the wheel. Vehicle The Vehicle class will be the finished product of your production line, being comprised of the other objects defined below. You will need to store the following data: • The price • Wheels • A Chassis (body of car)

• Is it drivable? (Boolean) The quality of the chassis and the condition of the wheels will determine the price of the vehicle. The base price of all vehicles is 500. The chassis will apply a multiplier of 5, 8 or 12 to this, depending on its quality. Likewise, the quality of each wheel will apply a multiplier of 1.5, 1.8 or 2.2. (Maybe price should be a float to account for this?). Additionally, a vehicle only becomes drivable once it has the appropriate number of wheels added to it. An example: A good, small chassis with 2 poor wheels and 1 fair wheel. Bolded is the wheel multipliers (3 of them). 500 * 12 * (1.5 * 1.5 * 2.2) = 29,700 In addition to the above, you will need to implement the following methods:

• addWheel() will is fairly self-explanatory, adding a new wheel object to your car (consider using a vector for this). An additional condition is that if you have already added the max number of wheels for the given vehicle (chassis size), the message "You've already added all the wheels!" should be displayed

• isBuilt() should return a Boolean as to whether or not the chassis and all wheels have been added to the vehicle.

• Drive() will give your car the ability to go for a test run. The integer it takes in should be the mileage you want the vehicle to travel. If the value entered is greater than the tire with the least mileage left, you should display the output "Broke Down!". After every drive print "You've traveled x miles!" where x is the amount traveled. If you broke down, this value could be different from the value passed into the function. Additionally, make sure to change the condition of the wheels based on their mileage left. If above 10,000 they are good. If above 5,000 they are fair. Below that you have poor wheels. Keep in mind, a change in condition also means a change in price for the vehicle! Finally, if you attempt to drive the vehicle before it is built, the message "Vehicle not built. Literally un-drivable" should be displayed.

• getChassis() should just return the current vehicle's chassis.

• Display() should display all the information of a vehicle and its associated chassis and wheels. Here is a sample output: Tips A few tips about this assignment:

• You can print out a tab character (the escape sequence '\t') to help line up theoutput.

• Don't try to tackle everything all at once. Work on one class at a time. Can't have a Car without a Chassis.

• You can customize the way numbers are displayed in C++ (particularly floating-point numbers). The header file contains this functionality. Look into std::fixed andstd::setprecision()

Main class

#include "Vehicle.h"

#include "Wheel.h"

#include

int main()

{

Wheel plainWheel;

Chassis plainChassis("medium");

Vehicle firstCar(plainChassis);

for(int i=0; i < firstCar.getChassis().getNumWheels(); i++) {

firstCar.addWheel(plainWheel);

}

//since all plainWheels have been added, it should be built

if(firstCar.isBuilt()) {

std::cout << "Built!\n" << std::endl;

firstCar.Display();

}

Chassis superChassis("large","good");

Vehicle superCar(superChassis);

if(!superCar.isBuilt()) {

std::cout << "Where are the wheels!\n" << std::endl;

}

Wheel superWheel("good");

superCar.addWheel(superWheel);

superCar.addWheel(superWheel);

superCar.addWheel(superWheel);

superCar.addWheel(superWheel);

superCar.addWheel(plainWheel);

superCar.addWheel(plainWheel);

superCar.Display();

superCar.Drive(8000);

superCar.Display();

Wheel badWheel("poor");

Chassis reallyBadChassis("small", "poor");

Vehicle badCar(reallyBadChassis);

for(int i=0; i < badCar.getChassis().getNumWheels(); i++) {

badCar.addWheel(badWheel);

}

badCar.Display();

badCar.Drive(6000);

badCar.Display();

return 0;

}

Reference no: EM132233436

Questions Cloud

National government does not share sovereign power : In a federal form of government, the national government does not share sovereign power with the states.?
Strategic business analysis - developing a plan for growth : You analyzed the companys organizational structure and performance. In this module, you will use and apply concepts related to internal
What is the annual percentage change in cny : What happened to CNY against USD? What happened to USD against CNY? What is the annual percentage change in CNY? In USD?
What is the cost of equity : Its WACC (weighted average cost capitol) is 9.4%, the tax rate is 35%, and the after tax cost of debt is 6.8%. What is the cost of equity?
Represent a hypothetical car production line : This program will represent a hypothetical car production line, which consists of a chassis (body of a vehicle) and wheels. These two components will be used.
What is the cost of the preferred stock : Snowbird LLC has a preferred stock that with an annual dividend of $3.25. If the current price of the preferred stock is $30, what is the cost of the preferred
Biggest differences in quality for goods-services delivery : Which of the following represents one of the biggest differences in quality for goods and services delivery?
Write a payroll calculation program : A local small business has hired you to write a payroll calculation program. The program only needs to calculate gross pay for an employee and display.
What type of culture is at the university of washington : ITS 835 What type of culture is at the University of Washington? Why is culture important to consider when implementing ERM?

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd