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
module, function
Started by mike221, Oct 03 2008 09:39 AM
10 replies to this topic
#1
Posted 03 October 2008 - 09:39 AM
|
|
|
#2
Posted 03 October 2008 - 09:47 AM
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.
#3
Posted 03 October 2008 - 09:55 AM
could someone please help? I will see a language later, first I need a help with a module and a function
#4
Posted 03 October 2008 - 10:00 AM
I mean first in theory, in algorithm sense. but later for example python, java, php...
#5
Posted 03 October 2008 - 10:30 AM
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.
#6
Posted 03 October 2008 - 11:04 AM
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
MODULE ReturnMoney (y) (Items_sum, cash_payment)RETURNS money_back
RETURN money_back=f1 cash_payment - Items_sum
ENDMODULE
#7
Posted 03 October 2008 - 12:09 PM
It will depend on the language.
#8
Posted 03 October 2008 - 12:49 PM
sorry. Well; python
#9
Posted 03 October 2008 - 01:19 PM
Moved to Python forum so those who know it's details can help.
#10
Posted 04 October 2008 - 07:09 AM
Could someone help?, please.
#11
Posted 04 October 2008 - 05:07 PM
BeginnersGuide - PythonInfo Wiki
Learn the language. We're not your personal teachers, but we will help you if you get stuck on something specific.
Learn the language. We're not your personal teachers, but we will help you if you get stuck on something specific.


Sign In
Create Account


Back to top









