// This pseudocode segment is intended to compute the cost per // day for a vaca
ID: 3634979 • 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
Dear,
Debug the code needed in which programming language not specified giving you in c++
#include<iostream>
using namespace std;
void main()
{
int totalDollarsAvailable;
int dollarsPerDay;
int totalMoneyAvailable=200;
cout<<"Enter amount:";
cin>>totalDollarsAvailable;
while(totalDollarsAvailable!= 0)
{
dollarsPerDay = totalMoneyAvailable / 7;
cout<< dollarsPerDay<<endl;
}
cin>>totalDollarsAvailable;
if (dollarsPerDay > 100)
cout<<"You'd better search for a bargain vacation"<<endl;
system("pause");
}
But the code is an infinite loop
Hope this will help you..
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.