Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

// This pseudocode segment is intended to compute the cost per // day for a vaca

ID: 3635158 • Letter: #

Question

// This pseudocode segment is intended to compute the cost per
// day for a vacation. The user enters a value for total dollars
// available to spend and can continue to enter new dollar amounts
// while the amount entered is not 0. For each new amount entered,
// if the amount of money available to spend per day is below $100,
// a message is displayed.
input totalDollarsAvailable
while totalDollarsAvailable not = 0
dollarsPerDay = totalMoneyAvailable / 7
output dollarsPerDay
endwhile
input totalDollarsAvailable
if dollarsPerDay > 100 then
output “You'd better search for a bargain vacation”
endwhile

Explanation / Answer

You basically have most of it correct, the one major thing is you have to endwhiles, when you only need 1. Also you must put the new inputDollarsAvailable before the end of the while loop so that it can be checked if = 0 the next time the loop runs. input totalDollarsAvailable while totalDollarsAvailable not = 0 dollarsPerDay = totalDollarsAvailable / 7 if dollarsPerDay >= 100 then output dollarsPerDay else if dollarsPerDay < 100 then output “You'd better search for a bargain vacation” input totalDollarsAvailable endwhile