Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: module, function

  1. #1
    mike221 is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    module, function

    I want to do a module, a Function-type module.
    I just want that module is right and then I may try
    for example java, php, python - but that's not an issue now, I will see that later.

    The module calculates the amount of the cash payment in connection with refundable sum of money.
    And there must be a function, that will make a rounding with five penny accuracy.
    function's call is f1 (y), where y is sum to be rounded off. A rounded off sum is obtained as a return value of the function.

    This is very simple, I know, but I can't make this work, can you please help.
    So this is how I have done it, but this isn't right.

    MODULE ReturnMoney (y) (Items_sum, cash_payment)RETURNS money_back

    money_back=f1 cash_payment - Items_sum ROUNDING??? HOW AND WHERE I PUT IT.....

    ENDMODULE

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,486
    Blog Entries
    75
    Rep Power
    143

    Re: module, function

    This is easy in any language, but you really need to pick a language first. Note that not all languages support the concept of modules/functions.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    mike221 is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: module, function

    could someone please help? I will see a language later, first I need a help with a module and a function

  5. #4
    mike221 is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: module, function

    I mean first in theory, in algorithm sense. but later for example python, java, php...

  6. #5
    Join Date
    Jul 2006
    Posts
    16,486
    Blog Entries
    75
    Rep Power
    143

    Re: module, function

    You will probably need to multiply the value by 100, convert it to an integer, perform modulus division by 5, and then increase the original value by +2, +1, 0, -1, or -2 cents depending on that result.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  7. #6
    mike221 is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: module, function

    thanks, But how I do that? I don't know how, I don't understand. And will I need another RETURN like this?;

    MODULE ReturnMoney (y) (Items_sum, cash_payment)RETURNS money_back

    RETURN money_back=f1 cash_payment - Items_sum

    ENDMODULE

  8. #7
    Join Date
    Jul 2006
    Posts
    16,486
    Blog Entries
    75
    Rep Power
    143

    Re: module, function

    It will depend on the language.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  9. #8
    mike221 is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: module, function

    sorry. Well; python

  10. #9
    Join Date
    Jul 2006
    Posts
    16,486
    Blog Entries
    75
    Rep Power
    143

    Re: module, function

    Moved to Python forum so those who know it's details can help.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  11. #10
    mike221 is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: module, function

    Could someone help?, please.

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 11-12-2010, 05:47 PM
  2. what a module can use in C
    By kiddies in forum C and C++
    Replies: 2
    Last Post: 06-14-2009, 07:08 AM
  3. Module Help!
    By J-Camz in forum C and C++
    Replies: 3
    Last Post: 11-27-2008, 03:45 PM
  4. module, function
    By mike221 in forum General Programming
    Replies: 7
    Last Post: 10-03-2008, 01:49 PM
  5. function module
    By alberto in forum General Programming
    Replies: 0
    Last Post: 08-08-2008, 04:16 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts