Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 2: A government research lab has concluded that an artificial sweetener

ID: 3550513 • Letter: P

Question

Problem 2: A government research lab has concluded that an artificial sweetener commonly used in diet soda pop will cause death in laboratory mice. A friend of yours is desperate to lose weight but cannot give up soda pop. Your friend wants to know how much diet soda pop it is possible to drink without dying as a result. Write a program to supply the answer. The input to the program is the amount of artificial sweetener needed to kill a mouse, the weight of the mouse and the weight of the dieter. To ensure the safety of your friend, be sure the program requests the weight at which the dieter will stop dieting, rather than the dieter

Explanation / Answer


//Author: Andy8
//Soda Pop Death
//Date: 23 August 2011

#include <iostream>
using namespace std;

int main()
{

const double DIET_SODA_SWEETNER = 0.001;
int DietSodaPopCans;
double SweetnerMouse;
double WeightMouse;
double SweetnerDieter;
double WeightDieter;

cout << "This program calculates how many cans of soda it will take to kill you ! ";
cout << "Each can contains 0.001 (0.1%) of artificial sweetener " << endl;

cout << "Enter the amount of Artificial Sweetner needed to kill a mouse: ";
cin >> SweetnerMouse;

cout << "Enter the weight of the mouse in grams: ";
cin >> WeightMouse;

cout << "Enter the weight of the dieter in grams at which dieting activity will be stopped: ";
cin >> WeightDieter;

SweetnerDieter = (SweetnerMouse/WeightMouse) * WeightDieter;

DietSodaPopCans = (SweetnerDieter/DIET_SODA_SWEETNER);

cout << "The amount of Diet Soda Pop Can's that would kill the dieter is: " << DietSodaPopCans;

return 0;


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote