Question: Fill in the following program so that it will correctly calculate the price of the orange juice the user is buying based on the Buy

Fill in the following program so that it will correctly calculate the price of the orange juice the user is buying based on the Buy One Get One sale.

#include

//main function int main() { int cartons; float price, total;

//prompt user for input information printf("What is the cost of one container of OJ in dollars? "); scanf(" [ Select ] ["%d", "%c", "%f", "%lf"] ", &price);

printf("How many containers are you buying? "); scanf(" [ Select ] ["%d", "%c", "%f", "%lf"] ", &cartons);

if ( [ Select ] ["cartons / 2", "cartons % 1", "cartons % 2", "cartons % price", "cartons / price", "cartons / total"] [ Select ] ["=", "==", "!=", "<=", ">=", "<"] 0) total = [ Select ] ["price * cartons", "cartons * price / 2 + price", "(cartons / 2) * price", "cartons / (2.0 * price)", "(cartons / 2.0) * price + price", "((cartons / 2) * price) + price"] ; else total = ((cartons / 2) * price) + price;

printf("The total cost is $%.2f. ", total);

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!