so i am trying to learn java on my own as a hobby, because well i didn't see my self doing this for a living, and i did terrible in the class, so i am going over the text book again, and starting from scratch.
i am not sure if i did this exercise correctly, it runs, but i want to make sure its the logical answer.
il summarize
A government research lab has conducted an artificial sweetner in diet soda has killed mice, you friend wishes to loose weight and wants to know how much he an drink. the program has no input. make sure to define the following constants, the amount of sweetner needed to kill the mouse, the weight of the mouse, starting weigh of your friend, and desired weight of your friend. to ensure his safety use the weight at which your friend will sop dieting. also 0.1% of the soda is sweetener, use another constant for this. if you don't use a defined constant its fine.
and here is my code
public class Exercise_4
{
public static void main(String[] args)
{
//declare variables
int AMOUNT_SODA;
int MOUSE_WEIGHT;
int START_WEIGHT;
int DESIRED_WEIGHT;
double SWEETNER_PERCENT_SODA;
double sweetnerKillMouse; // amount of sweetner that will kill mouae
double sweetnerKillHuman;//amount of soda that will kill a human
double newAmountSoda;
//assigne variables
AMOUNT_SODA = 12;//espressed in oz
MOUSE_WEIGHT = 2;//expressed in lbs
START_WEIGHT = 150;
DESIRED_WEIGHT = 140;
SWEETNER_PERCENT_SODA = 0.001;
//find out how much sweet ner killed te mouse
sweetnerKillMouse = SWEETNER_PERCENT_SODA * AMOUNT_SODA;
//find out how much sweetner human drinks till he dies
//(amount of sweetner that kills human / human weight) = (amount that kills mouse / mouse weight)
sweetnerKillHuman = DESIRED_WEIGHT * sweetnerKillMouse / MOUSE_WEIGHT;
//find out the total amount of sida which has the amount of sweetner that kills a human
//(amount of sweetner that kills the mouse / amount of soda ) = (amount of sweetner that kills human / new amount of soda)
newAmountSoda = (AMOUNT_SODA * sweetnerKillHuman) / sweetnerKillMouse;
//display
System.out.println(newAmountSoda);//MY RESULT IS 840.00
}//end main
}//end class