Thread: Math problems...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    153

    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. #2
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    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)
    Last edited by The Brain; 05-31-2005 at 04:02 PM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    153

    ...hmmm....about that...:p

    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. #4
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    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.
    Last edited by The Brain; 06-01-2005 at 08:33 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    153
    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. #6
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942
    It doesn't matter which you put on top.

  7. #7
    Registered User
    Join Date
    Mar 2004
    Posts
    536
    Quote 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. #8
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>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.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. American math students ...
    By whiteflags in forum A Brief History of Cprogramming.com
    Replies: 36
    Last Post: 05-26-2008, 12:47 PM
  3. Random math problems
    By got1sleeve in forum C++ Programming
    Replies: 3
    Last Post: 01-23-2008, 11:20 PM
  4. making a math quiz program
    By mackieinva in forum C Programming
    Replies: 10
    Last Post: 09-17-2007, 03:38 PM
  5. Library for matrix math/ linear algebra?
    By The V. in forum C++ Programming
    Replies: 0
    Last Post: 09-25-2001, 10:36 PM