Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 5 . 1 Project 1 : Theater As the manager of a movie theater, you are looking for ways to speed up taking inventory

15.1 Project 1: Theater
As the manager of a movie theater, you are looking for ways to speed up taking inventory at the end of each week. Write a program to track the following items:
Cups (5 cents each)
Candy bars (30 cents each)
Bags of popcorn (20 cents each)
Bottled water (50 cents each)
At the end of each week, you want to enter how many of each item you have, and your program will calculate how many of each item you need to order when you want the following quantities of each at the start of the week:
Cups: 2000
Candy bars: 1000
Bags of popcorn: 2500
Bottled water: 750
The input will be formatted as a space-separated list of numbers representing the number of cups, candy bars, bags of popcorn, and bottles of water remaining. For example:
368453231576
Would mean you have 368 cups, 453 candy bars, 231 bags of popcorn, and 576 bottles of water. Your program should then calculate:
How many of each item you need to restock
The total cost to restock
The average number of each item sold per day (the theater is open 7 days a week)
Example
Enter the number of cups, candy, popcorn, and water remaining:
368453231576
Need: 1632 cups, 547 candy bars, 2269 bags of popcorn, and 174 bottles of water
Cost: 786 dollars and 50 cents
Average sold: 233.14 cups, 78.14 candy bars, 324.14 bags of popcorn, and 24.86 bottles of water per day
Notes
Be sure to match the output in the example exactly. You do not need to worry about handling plural vs. singular forms of the words in the output. For example, outputting 1 cups is acceptable and expected.
Do not use the type float; use double instead.
To print doubles with two decimals, use printf("%.2lf", var);
Assume valid input.
Remember: doubles do not store values 100% precisely. Because of this precision loss, you may need to round() when determining cents, or store and perform all calculations using ints.
Testing
A part of programming is testing your code. While there may be example case(s), you should also develop test cases of your own before submitting. Think of the following cases to check:
Did not sell anything (all items fully stocked)
Sold everything (all items at 0)
Sold only 1 of an item
Sold only 1 of each item
Etc.

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

Genomes Browsers And Databases Data Mining Tools For Integrated Genomic Databases

Authors: Peter Schattner

1st Edition

0521711320, 978-0521711326

More Books

Students also viewed these Databases questions

Question

Introduce and define metals and nonmetals and explain with examples

Answered: 1 week ago

Question

What is IUPAC system? Name organic compounds using IUPAC system.

Answered: 1 week ago

Question

What happens when carbonate and hydrogen react with carbonate?

Answered: 1 week ago