Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## Kill the Mice!

Hi all. I'm trying to get a jump start on some homework for next semester and wanted to run this problem by you guys:

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's current weight. Assume that diet soda contains 1/10th of 1% of artificial sweetener. Use a variable declaration with the modifier const to give a name to this fraction. You may want to express the percent as the double value 0.001. Your program should allow the calculation to be repeated as often as the user wishes.

Below is the code I have created; did I do my math right? I think I have, but I just want to make sure before I keep plugging away.

```public class killthemouse {
public static double amtToKillMouse = .2;
public static double weightMouse = 50;
double weightHuman = 300;
public static double weightWant = 200;
public static double sweetenerConcentration = 0.001;

public static void main(String[] args) {

double Ratio2KillMouse = ((amtToKillMouse / weightMouse));
double convert2Human = (Ratio2KillMouse * weightWant);
double humanFatal = (convert2Human / sweetenerConcentration);
System.out.println(humanFatal + " units will be fatal to a human.");
}
}```

Thanks.

2. ## Re: Kill the Mice!

Where is dietSoda?