CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Algorithm Help

 



arousek
Novice

Apr 13, 2010, 1:35 AM

Post #1 of 7 (861 views)
Algorithm Help Can't Post

Hi Guys I am creating an algorithm that will get opening balance, withdraws, deposits there is a federal tax of 1% on withdraws and deposits made under $5000 over $5000 there is a 2% tax on withdraws and deposits. My program can calculate the 1% tax however when i input entry of more than 5000 it still calculate 1% tax and not 2% tax i have however entered the fromula for 2% tax. Can someone take a look at my code and see what is wrong Thanks


(This post was edited by arousek on Apr 13, 2010, 1:39 AM)
Attachments: script.pl (0.64 KB)


MetalGear
Novice


Apr 13, 2010, 1:43 AM

Post #2 of 7 (846 views)
Re: [arousek] Algorithm Help [In reply to] Can't Post

replace

elsif($total=>5000)


with

elsif($total>=5000)


arousek
Novice

Apr 13, 2010, 2:14 AM

Post #3 of 7 (843 views)
Re: [arousek] Algorithm Help [In reply to] Can't Post

Thank you for helpSmile


arousek
Novice

Apr 13, 2010, 5:26 AM

Post #4 of 7 (838 views)
Re: [arousek] Algorithm Help [In reply to] Can't Post

Hi, I tried it out and still calculates on 1% and not 2%


FishMonger
Veteran / Moderator

Apr 13, 2010, 5:41 AM

Post #5 of 7 (836 views)
Re: [arousek] Algorithm Help [In reply to] Can't Post

You never assigned a value to $total.

Every Perl script you write should include these pragmas:

Code
use strict; 
use warnings;


If you had included those pragmas, perl would have told about the problem.


arousek
Novice

Apr 13, 2010, 6:05 AM

Post #6 of 7 (833 views)
Re: [FishMonger] Algorithm Help [In reply to] Can't Post

ok, I dont know what to replace the total with ?
Thanks for help


FishMonger
Veteran / Moderator

Apr 13, 2010, 6:12 AM

Post #7 of 7 (831 views)
Re: [arousek] Algorithm Help [In reply to] Can't Post


In Reply To
ok, I dont know what to replace the total with ?
Thanks for help


The answer is:

Quote
there is a federal tax of 1% on withdraws and deposits made under $5000 over $5000 there is a 2% tax on withdraws and deposits


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives