A beverage manufacturer produces a popular drink in 500 ml cans (0.5 litres). The drink is sold in cases containing 24 cans. To produce 1000 litres of the drink, 59 litres of a special ingredient is required. The remainder consists of water to which 200 kilograms of sugar is added (assume that sugar does not affect volume). Write a program which accepts as input the number of cases of the drink that are required and calculates and displays the following:   The amount of litres of the special ingredient required The amount of kilograms of sugar required The amount of water required   Must be written in C++, no arrays to be used and only use iostream library

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
icon
Concept explainers
Question

A beverage manufacturer produces a popular drink in 500 ml cans (0.5 litres). The drink is sold in cases containing 24 cans. To produce 1000 litres of the drink, 59 litres of a special ingredient is required. The remainder consists of water to which 200 kilograms of sugar is added (assume that sugar does not affect volume).

Write a program which accepts as input the number of cases of the drink that are required and calculates and displays the following:

 

  • The amount of litres of the special ingredient required
  • The amount of kilograms of sugar required
  • The amount of water required

 

Must be written in C++, no arrays to be used and only use iostream library

Expert Solution
Step 1

Program:

//included header file

#include<iostream>

//included namespace

using namespace std;

//main funtion

int main()

{

               //constant variable declarations

               const double can=0.5;

               //computed litres of drink in 1 cases

               double cases=24*can;

               //declare drink

               double drink=1000;

               //declare ingrediant in 1000 litre

               int ingrediant=59;

               //computed water content

               int water=1000-59;

               //declare sugar in 1000 litre

               int sugar=200;

               //computed ingrediant of 1 cases

               double ingrediant1cases=(ingrediant/drink)*cases;

               //computed water of 1 cases

               double water1cases=(water/drink)*cases;

               //computed sugar of 1 cases

               double sugar1cases=(sugar/drink)*cases;

               //declare variable requiredCases for input

               int requiredCases;

               //input number of cases from the user

               cout<<"Enter the number of cases of the drink that are required: ";

               cin>>requiredCases;

               //produce output

               cout<<"The amount of litres of the special ingredient required: "<<requiredCases*ingrediant1cases<<endl;

               cout<<"The amount of kilograms of sugar required: "<<requiredCases*sugar1cases<<endl;

               cout<<"The amount of water required: "<<requiredCases*water1cases<<endl;

               return 0;

}

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Operators
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