lastquiz

lastquiz - void increment TotalGas(int gas_bought) int...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 1. Write a complete definition of a C++ class whose objects will represent automobiles. Include the following memebers in the c definition. Use appropriate data types for class member data. String variables may be used where appropriate. Data Members Year Make Model Number of doors Odometer reading (mileage) Gas Tank capacity (gallons) Total gas bought (gallons) Gas mileage(miles/gallon) Member Functions setAllData (Specify all parameters except mileages) incrementOdometer (Sprecify mileage parameter) increment TOtalGas(specify gas parameter) calculateMileage()//calculate gass mileage 2. Write the complete implementations of all four member functions above. Class automobile { public automoblie(//Item constructor int Year, //year int Make, //type of make int model,//vehicle model int doors, //nubmer of doors int odometer,//reading on the odometer int gas_bought, // total gas bought int gas_mileage) // miles/ gallon void setAllData( int Year, int Make, int model, int doors, int gas_bought, int gas_mileage)) void incrementOdometer (int odometer)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: void increment TotalGas(int gas_bought) int calulateMileage() void displayALLData() Private int a_Year int a_Make int a_model int a_doors int a_odometer int a_gas_bought int a_gas_mileage } Sheet1 Page 2 automobile::automobile(int Year, //year int Make, //type of make int model,//vehicle model int doors, //nubmer of doors int odometer,//reading on the odometer int gas_bought, // total gas bought int gas_mileage) // miles/ gallon i void automobile::setAllData(int Year, int Make, int model, int doors, int gas_bought, int gas_mileage)):a_Year(Year) { } void automobile::incrementOdometer(int odometer) { a_odometer+=odometer } void automobile::incrementTotalGas(int gas_bought) { a_gas_bought+=gas_bought } into automobile::calculateMileage() return odometer/gasbought r Sheet1 Page 3 //set all data members //Add tp odometer reading //Add to total gas bought //vehicle model //nubmer of doors //reading on the odometer // total gas bought Sheet1 Page 4...
View Full Document

Page1 / 4

lastquiz - void increment TotalGas(int gas_bought) int...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online