|
||||||
| Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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 |
| Sponsored Links |
|
|
|
|||||
|
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.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
|
|||||
|
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.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
| Sponsored Links |
|
|
|
|||
|
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 |
|
|||||
|
It will depend on the language.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
|
|||||
|
Moved to Python forum so those who know it's details can help.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| function module | alberto | General Programming | 0 | 08-08-2008 07:16 AM |
| Inline function | Chinmoy | C Tutorials | 1 | 04-07-2008 04:13 PM |
| using Template function | Chinmoy | C Tutorials | 4 | 04-03-2008 05:16 AM |
| Joomla! Tutorial #3: CSS Class Suffix | takercena | Tutorials | 1 | 03-14-2008 02:51 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |