Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Integers numSodas and cash are read from input. A soda costs 7 dollars. If numSodas is greater than or equal to 5 , then assign

Integers numSodas and cash are read from input. A soda costs 7 dollars.
If numSodas is greater than or equal to 5, then assign variable totalCost with the product of numSodas and 7.
If totalCost is less than or equal to cash, then output "Sodas successfully purchased."
Otherwise, output "Not all sodas purchased."
If cash is greater than or equal to 7, then output "At least one item was purchased."
If numSodas is greater than 39, then output "Now out of stock."
End each output with a newline.

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

Step: 3

blur-text-image

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

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

Identify three types of physicians and their roles in health care.

Answered: 1 week ago

Question

Compare the types of managed care organizations (MCOs).

Answered: 1 week ago