Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Python

Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-03-2008, 01:39 PM
mike221 mike221 is offline
Newbie
 
Join Date: Oct 2008
Posts: 11
Rep Power: 0
mike221 is on a distinguished road
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 10-03-2008, 01:47 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,405
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default 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.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-03-2008, 01:55 PM
mike221 mike221 is offline
Newbie
 
Join Date: Oct 2008
Posts: 11
Rep Power: 0
mike221 is on a distinguished road
Default Re: module, function

could someone please help? I will see a language later, first I need a help with a module and a function
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-03-2008, 02:00 PM
mike221 mike221 is offline
Newbie
 
Join Date: Oct 2008
Posts: 11
Rep Power: 0
mike221 is on a distinguished road
Default Re: module, function

I mean first in theory, in algorithm sense. but later for example python, java, php...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-03-2008, 02:30 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,405
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default 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.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 10-03-2008, 03:04 PM
mike221 mike221 is offline
Newbie
 
Join Date: Oct 2008
Posts: 11
Rep Power: 0
mike221 is on a distinguished road
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 10-03-2008, 04:09 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,405
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default Re: module, function

It will depend on the language.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 10-03-2008, 04:49 PM
mike221 mike221 is offline
Newbie
 
Join Date: Oct 2008
Posts: 11
Rep Power: 0
mike221 is on a distinguished road
Default Re: module, function

sorry. Well; python
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 10-03-2008, 05:19 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,405
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default Re: module, function

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 10-04-2008, 11:09 AM
mike221 mike221 is offline
Newbie
 
Join Date: Oct 2008
Posts: 11
Rep Power: 0
mike221 is on a distinguished road
Default Re: module, function

Could someone help?, please.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

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


All times are GMT -5. The time now is 11:49 PM.

Contest Stats

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

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads