Python Help???

kosandpol

Well-known member
  • Jun 10, 2008
    45,329
    1,492
    113
    පයිතන් නං දන්නේ නෑ හැබැයි උඹේ ප්‍රශ්නේ කියපන්, අඩු ගානේ ප්‍රෝග්‍රෑම් ලොජික් එක වත් දෙන්න පුළුවන් වෙයි..
     
    • Like
    Reactions: ll-MegaMind-ll

    ll-MegaMind-ll

    Well-known member
  • May 13, 2011
    4,530
    699
    113
    Dharmayaiobai.org
    You've just feasted on a truly delicious meal of Spam and eggs. The diner's computer is down, however, so you'll need to compute the cost of your meal yourself.

    Here's how it'll break down:

    Cost of meal: $44.50

    Restaurant tax: 6.75%

    Tip: 15%

    You'll want to apply the tip to the overall cost of the meal (including tax).

    logic akak onath na... mata normal widihata meka hadana hati kiyahao..mata maths baha ban
     

    kosandpol

    Well-known member
  • Jun 10, 2008
    45,329
    1,492
    113
    You've just feasted on a truly delicious meal of Spam and eggs. The diner's computer is down, however, so you'll need to compute the cost of your meal yourself.

    Here's how it'll break down:

    Cost of meal: $44.50

    Restaurant tax: 6.75%

    Tip: 15%

    You'll want to apply the tip to the overall cost of the meal (including tax).

    logic akak onath na... mata normal widihata meka hadana hati kiyahao..mata maths baha ban
    Code:
    function calculate_total( $cost_of_meal as double) as double
    {
      $subtotal = $cost_of_meal +(($cost_of_meal * 6.75)/100); //restaurant tax
      calculate_total=$subtotal+(($subtotal * 15)/100); //tip
    }

    ඔන්න ඕක පයිතන් වලට හරවන්න.
     

    usernameiwari

    Member
    Sep 19, 2013
    169
    52
    0
    Area 51
    You've just feasted on a truly delicious meal of Spam and eggs. The diner's computer is down, however, so you'll need to compute the cost of your meal yourself.

    Here's how it'll break down:

    Cost of meal: $44.50

    Restaurant tax: 6.75%

    Tip: 15%

    You'll want to apply the tip to the overall cost of the meal (including tax).

    logic akak onath na... mata normal widihata meka hadana hati kiyahao..mata maths baha ban

    44.50 * (1 + 0.0675) * (1 + 0.15)
     
    Last edited:

    M E T H

    Active member
  • Oct 23, 2013
    647
    48
    28
    මම දන්න පයි තන් රෙද්දක් නෑ බන් මම දන්න PHP වලින් කෝඩ් එකක් ගැහැව්වා බලපන් හරිද කියල. හැබැයි මේකේ හැටියටනම් හෙනම සිම්පල් කේස් එකක්. :cool:;)

    PHP:
    <?php
    // simple script by M E T H @Elakiri.com
    // generate overall cost of meal
    
    $costOfMeal = 44.5;
    $tax = (6.75 / 100) * $costOfMeal;
    
    $costOfMealWithTax = $costOfMeal + $tax;
    $tip = (15 / 100) * $costOfMealWithTax;
    
    echo $total = $costOfMealWithTax + $tip;
    
    
    ?>
     
    • Like
    Reactions: ll-MegaMind-ll