pseudocode for 6% sales tax

Discussion in 'Programming' started by freybear3, Dec 11, 2008.

  1. #1
    i need a pseudocode for a 6% sales tax

    can anyone make that for me?
     
    freybear3, Dec 11, 2008 IP
  2. Acecool

    Acecool Peon

    Messages:
    267
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not sure what you are looking for exactly...

    Total = $1.00
    Tax = 106% (Reason for doing it this way is so you dont have to multiply for 6% then re-add the total...)
    Total * Tax = Total With Tax

    $total = 1.00;
    $tax = 1.06; // 6% sales tax.... for 7.5 use 1.075
    
    $with_tax = $total * $tax;
    PHP:
     
    Acecool, Dec 11, 2008 IP
  3. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #3
    That is not pseudo code , OP should try doing his homework himself.
     
    it career, Dec 12, 2008 IP
  4. freybear3

    freybear3 Well-Known Member

    Messages:
    409
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #4
    lol@homework.....i wish i was that young lol
     
    freybear3, Dec 12, 2008 IP
  5. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #5
    It really depends on how you really do the Psuedocode. Some people would agree with what I did, some won't, others do it almost exactly like source code, which I disagree with.
    BEGIN SalesTax (Amount)
      SET Rate to 1.06
      SET WithTax to Amount * Rate
      RETURN WithTax
    END SalesTax
    Code (markup):
     
    chopsticks, Dec 13, 2008 IP
  6. freybear3

    freybear3 Well-Known Member

    Messages:
    409
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #6
    This look good? Any errors?





    [start]
    print "Type a dollar and cent amount."
    print
    input "Press Enter' alone for help ?"; amount
    print
    if amount = 0 then goto [help]
    print
    let tax = amount *0.05
    print "Tax is: "; tax; " . Total is: "; tax + amount
    goto [start]


    [help]
    cls
    print "This tax program determines how much tax is"
    print "due on an amount entered and also computes"
    print "the total amount. The tax rate is 5%"
    print
    input "Press [Enter] to continue."; dummyVariable
    print
    goto [start]
     
    freybear3, Dec 13, 2008 IP