Engineering-Computation Homework 6 Solved

30.00 $

Description

Rate this product
  1. Create5moreTrucks(foratotalof10).​Updatethevalueoftheprevious5 Trucks already created (from HW 5) to be current as of 4/8/2019, using the updateValue() method. Make sure to have a range of years, mileage, and models in your Truck vector.
  2. Findthetotalcurrentvalueofall10Trucks.​Useaccumulate,alambda function, and the method getValue(). Print the total to the screen with text explaining it is the total.
  3. Findthetotalestimatedvaluein5years.​Findtheestimatedvalueofall10 trucks in 5 years, using the estimateVal() free function. Then use accumulate to find the total future value of all 10 trucks (the returned future_vals float vector). Print it to the screen with an explanation.
  4. CreateaprintmethodwithintheTruckclass.​FirstcreateaTruckgetter method called getName() which returns <Year> + <Manufacturer> + <Model> + <4×4–if it has it>. Use the ternary (or immediate if) operator to decide what to print for the 4×4. Then create a print method called printTruck() and give it the appropriate type. Have it print getName().
  5. Sortyour10Trucksalphabetically.​SortbygetName().Usealambdainthe sort method. Using a ranged for loop, print out your 10 sorted Trucks using printTruck().
  6. Nowsortyourvectorof10Trucksbymileage.​Makesuretokeepthe alphabetical getName() order in the case of identical mileage. Again print out the Trucks.

Attach your source code, screenshots of output, and header (if used) files. Include compiled executables if you wish.

  • HW6-linxs2.zip