# Math problems...

This is a discussion on Math problems... within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Hey everyone, So I'm curious how I should approach this math problem. Basically, a person wants to know how much ...

1. ## Math problems...

Hey everyone,
So I'm curious how I should approach this math problem. Basically, a person wants to know how much artificial sweetener in a diet soda they can drink without dying (it's from a book...I'm not crazy...). And the input for this program is the amount of artificial sweetener needed to kill a mouse, the weight of the mouse, and the weight of the person who wants to know. And also the problem says to assume that the diet soda contains .001 percent of sweetener. Could someone possibly push me in a good direction? I've been looking at the problem for so long that I'm not even reading the words anymore haha.
---------------------------------------------------------------------------------

OH...and also, does anyone know of a good approach to convert military time (24 hour) to civilian time (12 hour) in terms of a program? I was thinking to simply check if 24 hour time entered is greater than or equal to 1300 AND less than or equal to 2400 and subtract 1200 if true, also, to make sure my am/pm boolean variable value is correct I would also have to make another if to check if the 24 hour time is greater than 1200....sound good so far? The only other issue I was having is how could I convert the new 12 hr time to a hh:mm:ss format? As usual, I'm not expecting answers (that doesnt help any), I'm looking for a good push. Thank you so much for reading all these words -Chap

2. Code:
``` amount to kill a mouse           amount to kill a person
__________________________  ==   ________________________
weight of the mouse              weight of the person```

Code:
```1)  check if time is am or pm

2)  if am, then time == time    (3:00am = 0300)

3)  if pm, then time = time+12  (3:00pm = 1500)```

Hey brain...curiously, why do you set the division up like that? I mean, why put amount to kill over weight of mouse? I'm sure it's a basic concept, but I'd appreciate the insight...thanks a lot, oh and thanks a lot for the response, very informative!

4. it's not division.. i simply set up a proportion (as indicated by the equals sign) which indicates the amount of sweetner to kill a mouse is proportional to the amount of sweetner to kill a person. If you know any 3 pieces of information, you can solve for the missing piece.

5. wow sorry this reply is so out of date haha, what I meant was what made you put the amount to kill on top of weight? It's little details like that I have trouble figuring out. Any help would be great, thanks for the help Brain. - Chap

6. It doesn't matter which you put on top.

7. Originally Posted by The Brain

Code:
```1)  check if time is am or pm

2)  if am, then time == time    (3:00am = 0300)

3)  if pm, then time = time+12  (3:00pm = 1500)```

Close, but no banana. Here is a table with a few more entries (you can do the math):

Code:
```12:01 am ==> 0001
1:01 am ==> 0101
.
.
.
11:01 am ==> 1101
12:01 pm ==> 1201
1:01 pm ==> 1301
.
.
.
11:01 pm ==> 2301```
Regards,

Dave

8. >>what I meant was what made you put the amount to kill on top of weight?
Well, the logic of that particular arrangement is:

1) Group the species, i.e. the mouse is all knowns, so we put all of the mouse info on the left and all the human info on the right - as I envision it, it's like, the mouse sets a constant lethal_dosage/weight proportion, and we must modify the variable on the human side to accomodate this proportion.

2) We arrange kill over top of weight, in a similar manner as we would arrange distance/time: It makes an intuitive constant, or in other words, we arrange it this way because lethal dose is naturally a function of weight, not vice versa.