Question
Fill in the following program so that it will track how much money your roommates owes you for the stolen juice. Your program should alert
Fill in the following program so that it will track how much money your roommates owes you for the stolen juice. Your program should alert you whenever your roommate's total reaches 10 dollars or more.
#include
int main() {
float initprice, price, total = 0; int initounces, ounces, times, i;
printf("What is the weight (in oz.) of the original container of OJ? "); scanf("%d", &initounces);
printf("What is the cost of the original container of OJ in dollars? "); scanf("%f", &initprice);
price = [ Select ] ["initprice", "initounces", "initprice / initounces", "initounces / initprice", "initprice / ounces", "price / initounces", "price / ounces", "ounces / price"] ;
printf("How many times did your roommate take your juice? "); scanf("%d", ×);
for (i= [ Select ] ["0", "1", "10", "times", "initounces", "initprice"] ; i< [ Select ] ["0", "1", "10", "times", "initounces", "initprice"] ; i++) {
printf("How much juice did your roommate take this time (in oz.)? "); scanf("%d", &ounces);
total = [ Select ] ["price", "price * ounces", "total + (price * ounces)", "initprice", "initprice * ounces", "total + (initprice * ounces)"] ;
if( [ Select ] ["total", "total > 10.0", "total >= 10", "total < 10", "total != 10", "total = 10"] ) {
printf("Your roommate owes you $10.00. "); [ Select ] ["no equation is needed here", "total = 0;", "total = 10;", "total = total - 10;", "ounces = 0;", "price = 0;"]
}
}
printf("Your roommate owes you $%.2f. ", [ Select ] ["initprice", "price", "total", "initounces", "ounces", "times", "i"] );
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started