need for a solving method

This is a discussion on need for a solving method within the C++ Programming forums, part of the General Programming Boards category; HI, I have this problem that I need to code . But I have problem about how to find the ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    39

    need for a solving method

    HI,
    I have this problem that I need to code . But I have problem about how to find the math method.

    A government research lab has concluded that an artificial sweetener commonly used in diet soda will cause death in laboratory mice. A friend of yours is desperate to lose weight but cannot give up soda. Your friend wants to know how much diet soda 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 the mouse, the weight of the mouse, and the weight of the dieter. To ensure the safety of your friend, be sure that the program requests the weight at which the dieter will stop dieting, rather than the dieter‘s current weight. Assume that diet soda contains one tenth of 1% artificial sweetener.
    Use a variable declaration with the modifier const to give a name to this fraction. You may want to express the percentage as .001.

    Please can someone help me how to find the quantity of diet soda to drink without dying.
    It seems simple but I dont get it.

    Thank you
    Last edited by Salem; 08-24-2006 at 05:30 AM. Reason: No reason for that much boldness in the text

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    Two things:

    One - that looks like a homework task to me, read the rules about posting homework

    Two - no offense but that seems pretty morbid to be a programming task.

    One hint - plan your idea on paper, as my game instructor told me, it is better to scrap a blue
    print than a 2000 line coded program!

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    74

    Question Eh..

    Just go tell your teacher you can't finish the problem 'cause your fat friend commited suicide. If she is unsympathetic to your answer sue her for irreperable damage to your pysche and collect that pain & suffering $$$$$.

    Two - no offense but that seems pretty morbid to be a programming task.
    So his teacher slowly killed a rat in his basement with cleaner fluid last weekend and needs his class to write a program so he can calculate the amount of poison it will take to kill his fat wife. What's wrong with that? At least his pyscho teacher is conserving poison rather than wasting an entire bottle on one person and was kind enough to substitute the words Cleaner fluid with Diet soda; Poison with Artificial Sweetner; and Fat lazy wife with friend.
    --------------------------

    On the otherhand if you're really determined to be an accessory to murder then perhaps calculating the amount of sweetner it takes to kill a 1 pound animal then use that to calculate the amount of sweetner it would take to kill off fatty.

    Of course my logic could be way off at which point you would fail this project horribly... enjoy.
    Last edited by Kurisu33; 08-24-2006 at 10:05 AM.

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    You typically ask this in a math forum, not a programming forum.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  5. #5
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Quote Originally Posted by Kurisu33
    Just go tell your teacher you can't finish the problem 'cause your fat friend commited suicide. If she is unsympathetic to your answer sue her for irreperable damage to your pysche and collect that pain & suffering $$$$$.


    So his teacher slowly killed a rat in his basement with cleaner fluid last weekend and needs his class to write a program so he can calculate the amount of poison it will take to kill his fat wife. What's wrong with that? At least his pyscho teacher is conserving poison rather than wasting an entire bottle on one person and was kind enough to substitute the words Cleaner fluid with Diet soda; Poison with Artificial Sweetner; and Fat lazy wife with friend.
    --------------------------

    On the otherhand if you're really determined to be an accessory to murder then perhaps calculating the amount of sweetner it takes to kill a 1 pound animal then use that to calculate the amount of sweetner it would take to kill off fatty.

    Of course my logic could be way off at which point you would fail this project horribly... enjoy.
    Code:
    :confused:
    hillarious but
    Code:
    :confused:

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,485
    Simple ratios which you should have learnt in school long ago.

    Can you even do this on paper?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,163
    Simple algebra. Solve for: s1/w1 = s2/w2

    s1 = amount of artificial sweetner to kill mouse
    w1 = weight of said mouse
    w2 = weight of your friend
    s2 = amount of artificial sweetner to kill your friend (your unknown variable).
    If you understand what you're doing, you're not learning anything.

  8. #8
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Quote Originally Posted by Kurisu33
    Just go tell your teacher you can't finish the problem 'cause your fat friend commited suicide. If she is unsympathetic to your answer sue her for irreperable damage to your pysche and collect that pain & suffering $$$$$.

    ......
    You can be funny and sarcastic, but your post was not at all helpful and I find it offensive. If you want to make a point, do it with respect for the OP and the rest of us forumers.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  9. #9
    Registered User
    Join Date
    Jan 2006
    Posts
    39
    Quote Originally Posted by itsme86
    Simple algebra. Solve for: s1/w1 = s2/w2

    s1 = amount of artificial sweetner to kill mouse
    w1 = weight of said mouse
    w2 = weight of your friend
    s2 = amount of artificial sweetner to kill your friend (your unknown variable).
    Yes thank you time 86.
    The fact that the give me the weight of the dieter as input confused me a little bit.
    In fact , I did not know if I have to use the target weight of the dieter OR the actual weight.

    Thank you
    B.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. on method pointers and inheritance
    By BrownB in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2009, 06:50 PM
  2. C# method
    By siten0308 in forum C# Programming
    Replies: 6
    Last Post: 07-15-2008, 07:01 AM
  3. Overriding a method in C
    By DavidDobson in forum C Programming
    Replies: 1
    Last Post: 07-05-2008, 07:51 AM
  4. Replies: 2
    Last Post: 01-22-2008, 03:22 PM
  5. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 06:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21