Starting from:

$30

Engineering-Computation-Homework 6 Solved

1.     Create 5 more Trucks (for a total of 10). Update the value of the previous 5​  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.     Find the total current value of all 10 Trucks. Use accumulate, a lambda​          function, and the method getValue(). Print the total to the screen with text explaining it is the total.  

3.     Find the total estimated value in 5 years. Find the estimated value of all 10​  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.     Create a print method within the Truck class. First create a Truck getter​         method called getName() which returns <Year> + <Manufacturer> + <Model> + <4x4--if it has it>. Use the ternary (or immediate if) operator to decide what to print for the 4x4. Then create a print method called printTruck() and give it the appropriate type. Have it print getName().

5.     Sort your 10 Trucks alphabetically. Sort by getName(). Use a lambda in the​   sort method. Using a ranged for loop, print out your 10 sorted Trucks using printTruck().

6.     Now sort your vector of 10 Trucks by mileage. Make sure to keep the​             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. 

More products