Unloading vehicle of groceries The bagsCarried can be a value of 1 through 4 bags at a
Question:
Unloading vehicle of groceries
The bagsCarried can be a value of 1 through 4 bags at a time. The bagsInVehicle is the total number of bags currently in my truck. The value of bags carried will be subtracted from the total number of bags within the vehicle until the number of bags within the vehicle equals 0. I normally try to take as many bags as possible on the first trip, but I know that taking only 2 bags per hand is a great way of not ruining any groceries or dropping any bags.
The pseudo code for unloading grocery bags from a vehicle is as follows below:
while (I still have grocery bags in my truck)
if (bags taken from vehicle is 1)
add 1 to bagsCarried
Subtract 1 from bagsInVehicle
if (bags taken from vehicle is 2)
add 2 to bagsCarried
Subtract 2 from bagsInVehicle
if (bags taken from vehicle is 3)
add 3 to bagsCarried
Subtract 3 from bagsInVehicle
if (bags taken from vehicle is 4)
add 4 to bagsCarried
Subtract 4 from bagsInVehicle
if (bagsInVehicle > 0)
I still have more grocery bags within my truck
else
I have taken all of the grocery bags from my truck.
Explain whether their pseudo code methods appropriately address all objects within the collection. If not, suggest code that should be added or modified. If you determine their code is complete as written, explain why.
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill