How to Calculate the Safe Consumption Limit of Diet Soda Using Programming?

  • Thread starter Thread starter brad sue
  • Start date Start date
  • Tags Tags
    Method
AI Thread Summary
The discussion revolves around coding a program to determine the safe amount of diet soda a person can consume without risking death from an artificial sweetener. The program requires inputs including the lethal dose of sweetener for a mouse, the mouse's weight, and the target weight of the dieter. To ensure safety, the program should calculate the lethal amount of sweetener for the dieter based on their target weight. It is suggested to express the concentration of sweetener in diet soda as 0.001 (or one-tenth of one percent) and use a constant variable for clarity. The calculation involves determining the lethal dose per unit mass and scaling it up for the dieter's weight, followed by converting this amount into the equivalent volume of diet soda. The discussion emphasizes the importance of accurate calculations to provide a safe consumption guideline.
brad sue
Messages
270
Reaction score
0
HI,
I have this problem that I need to code . But I have problem about how to find the math method.

A government research lab has concluded that an artificial sweetener commonly used in diet soda will cause death in laboratory mice. A friend of yours is desperate to lose weight but cannot give up soda. Your friend wants to know how much diet soda 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 the mouse, the weight of the mouse, and the weight of the dieter. To ensure the safety of your friend, be sure that the program requests the weight at which the dieter will stop dieting, rather than the dieter‘s current weight. Assume that diet soda contains one tenth of 1% artificial sweetener.
Use a variable declaration with the modifier const to give a name to this fraction. You may want to express the percentage as .001.


Please can someone help me how to find the quantity of diet soda to drink without dying.
It seems simple but I don't get it.

Thank you
 
Technology news on Phys.org
I would calculate the deadly amount of sweetener per unit of mass (from the firtst 2 inputs). If you multiply this with the third input you get the deadly amount of sweetener for the dieter. Multiplying the resoult by 100 should give you the amount of soda.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top