Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Explain how organisational behaviour impacts change strategies

Answered: 1 week ago

Question

7-16 Compare Web 2.0 and Web 3.0.

Answered: 1 week ago