In the ChiliToGo program in Exercise 12, the costs to produce an adult meal and a child’s meal are $4.35 and $3.10, respectively. Adult meals are sold for $7.00 and children's meals are sold for $4.00. Modify the ChiliToGo program to display the total profit for each type of meal as well as the grand total profit. An example of the program is shown below: Enter number of adult meals ordered >> 10 Enter number of child meals ordered >> 5 10 adult meals were ordered at 7.0 each. Total is 70.0 5 child meals were ordered at 4.0 each. Total is 20.0 Grand total for all meals is 90.0 Profits: Adult profit is 26.5 Child profit is 4.5 Total profit is 31.0

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In the ChiliToGo program in Exercise 12, the costs to produce an adult meal and a child’s meal are $4.35 and $3.10, respectively. Adult meals are sold for $7.00 and children's meals are sold for $4.00. Modify the ChiliToGo program to display the total profit for each type of meal as well as the grand total profit.

An example of the program is shown below:

Enter number of adult meals ordered >> 10 Enter number of child meals ordered >> 5 10 adult meals were ordered at 7.0 each. Total is 70.0 5 child meals were ordered at 4.0 each. Total is 20.0 Grand total for all meals is 90.0 Profits: Adult profit is 26.5 Child profit is 4.5 Total profit is 31.0

Expert Solution
Step 1

Algorithm for ChiliToGo program:

Define constants for the cost and price of adult and child meals.

Read the number of adult and child meals ordered by the user.

Calculate the total cost and revenue for each type of meal.

a. For adult meals:

i. Calculate the total cost as the product of the number of adult meals ordered and the cost per meal.

ii. Calculate the total revenue as the product of the number of adult meals ordered and the price per meal.

b. For child meals:

i. Calculate the total cost as the product of the number of child meals ordered and the cost per meal.

ii. Calculate the total revenue as the product of the number of child meals ordered and the price per meal.

Calculate the profit for each type of meal.

a. For adult meals, subtract the total cost from the total revenue.

b. For child meals, subtract the total cost from the total revenue.

Calculate the grand total for all meals.

a. Sum the total cost of both types of meals.

b. Sum the total revenue of both types of meals.

c. Calculate the grand total profit as the difference between the total revenue and total cost.

Display the results.

a. Show the number of adult and child meals ordered and the total revenue for each type of meal.

b. Show the grand total revenue for all meals.

c. Show the profit for each type of meal. d. Show the grand total profit.

 
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education