C++ questions 29 and 30 of chapter 8 (Starting_Out_With_C++_Early_Objects)

Feb 3rd, 2012
Studypool Tutor
Price: $10 USD

Tutor description

Programming Problem Write the program described in questions 29 and 30 at the end of chapter 8 in the textbook (page 565 in the 7th Ed [this is included as the pdf file], page 584 in 8th Ed.) But, use an array of pointersto Car objects. Additional instructions and hints: Initialize the first thee Car objects using the overloaded constructor. Avoid memory leaks (use delete on all fobjects you create with new.) Use good programming style: Use named constants where appropriate. Initialize all pointers to NULL. Write explanatory comments where appropriate. Indent code consistently . Use appropriate casing (camelCase, PascalCase, UPPER_CASE.) Write the entire program in a single file. Don’t include user input. Questions 29 and 30 (modified from the textbook version) Use the following Car class declaration with questions 29 & 30. You will need to add getters to get the values for the three member variables.

Word Count: 189
Showing Page: 1/2
Car.h#pragma once#include class Car{private:std::string make;std::string model;int year;double cost;public:Car();~Car();Car(std::string mk, std::string md, int yr, double c);std::string getMake();std::string getModel();int getYear();double getCost();void print();};Car.cpp#include "stdafx.h"#include "Car.h"#include Car::Car() { make = model = ""; year = 0; cost = 0; }Car::Car(std::string mk, std::string md, int yr, double c) { make = mk; model = md; year = yr; cost = c; }Car::~Car(){}std::string Car::getMake(){return make;}

Review from student

Studypool Student
" Excellent work as usual "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1820 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors