Question: PLD Chapter 10#4 pg.468 Assignment Design a class named Automobile that holds the vehicle identification number, make, model, and color of an automobile. Include methods
PLD Chapter 10#4 pg.468 Assignment
Design a class named Automobile that holds the vehicle identification number, make, model, and color of an automobile. Include methods to set the values for each data field, and include a method that displays all the values for each field.
---------------------------------------------------------------------
Provided PseudoCode:
// Pseudocode PLD Chapter 10 #4 pg. 468 // Start // Declarations // Automobile myAuto // string vin // string make // string model // string color // output "Please enter the Vehicle Identification Number: " // input vin // output "Please enter the Make: " // input make // output "Please enter the Mode: " // input model // output "Please enter the color: " // input color // Set the VIN for myAuto // Set the Make for myAuto // Set the Model for myAuto // Set the Color for myAuto // output "VIN: ", myAuto.getVin() // output "Make: ", myAuto.getMake() // output "Model: ", myAuto.getModel() // output "Color: ", myAuto.getColor()?
---------------------------------------------------------------------------
Provided Header File: Automobile.h
#include
using namespace std;
#ifndef _Automobile #define _Automobile class Automobile { private: string vin; // first name string make; // last name string model; // subject of the paper string color; // assigned letter grade
public: Automobile( ); void setVin(string v); void setMake(string ma); void setModel(string mod); void setColor(string c); string getVin( ); string getMake( ); string getModel( ); string getColor( ); void displayAutomobile();
}; #endif
----------------------------------------------------------------------
Provided .cpp file: Automobile.cpp
#include
using namespace std;
Automobile::Automobile( ) { vin=""; // Vehicle Identification make=""; // Make model=""; // Model color=""; // Color } void Automobile::setVin(string v) { vin = v; } void Automobile::setMake(string ma) { make = ma; } void Automobile::setModel(string mod) { model = mod; } void Automobile::setColor(string c) { color = c; } string Automobile::getVin( ) { return vin; } string Automobile::getMake( ) { return make; } string Automobile::getModel( ) { return model; } string Automobile::getColor( ) { return color; }
void Automobile::displayAutomobile() { cout << "Vehicle Identification Number: " << vin << endl << "Make: " << make << endl << "Model: " << model << endl << "Color: " << color << endl; }
I have seen other answers to this on Chegg, but I am a noob and don't know much about programming. I have tried to use the other answers and none of them will work in my DevC++, Please explain things like I am a beginner. Thanks in advance!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
