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


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Kill the Mice!

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Kill the Mice!

    Where is dietSoda?

Similar Threads

  1. Replies: 4
    Last Post: April 27th, 2010, 01:18 AM
  2. Kill a process
    By subhvi in forum Java Theory & Questions
    Replies: 5
    Last Post: January 14th, 2010, 09:11 PM
  3. How to kill proceses
    By oyekunmi in forum Java Theory & Questions
    Replies: 3
    Last Post: October 16th, 2009, 08:34 AM