Details of this Paper

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




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.;class Car { string make, model, int year, double cost;Constructors Car() { make = model = ??, year = cost = 0, } Car(string mk, string md, int yr, double c) { make = mk, model = md, year = yr, cost = c,};Getters To Do ? you need to add these };29. Define an array named forSale that holds 35 Car objects. Initialize the objects in the first three elements with the data below. The rest of the elements should contain NULL pointers. Make Model Year Cost Ford Taurus 2006 $18,000 Honda Accord 2004 $8,000 Jeep Wrangler 2007 $21,000;30. Write a loop that will step through the array you defined in question 29, displaying the contents of each element that doesn?t contain a NULL pointer.


Paper#67173 | Written in 18-Jul-2015

Price : $22