Sort by

recency

|

3403 Discussions

|

  • + 0 comments

    Write your code here

    # compute tip and tax amounts
    tip  = meal_cost * tip_percent / 100
    tax  = meal_cost * tax_percent / 100
    
    # total cost
    total_cost = meal_cost + tip + tax
    
    # Print rounded total (nearest integer)
    print(round(total_cost))
    
  • + 0 comments

    i am using def function but this is not exixt

  • + 0 comments

    function solve(meal_cost, tip_percent, tax_percent) { // Write your code here const tip = (tip_percent/100) * meal_cost; const tax = (tax_percent/100) * meal_cost; const total_cost = meal_cost + tip + tax; console.log(Math.floor(total_cost)); } why my code doesn't work for the last test case that it works fine for the rest three test cases.

  • + 0 comments

    print(round((meal_cost + (meal_cost * tip_percent / 100) + (meal_cost * tax_percent / 100))))

  • + 0 comments

    import java.io.; import java.math.; import java.security.; import java.text.; import java.util.; import java.util.concurrent.; import java.util.function.; import java.util.regex.; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList;

    class Result {

    public static void solve(double meal_cost, int tip_percent, int tax_percent) {
    double tip =(meal_cost/100)*tip_percent;
    double tax = (meal_cost/100)*tax_percent;
    double total = tip+tax+meal_cost;
    System.out.println(Math.round(total));
    }
    

    }

    public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

        double meal_cost = Double.parseDouble(bufferedReader.readLine().trim());
    
        int tip_percent = Integer.parseInt(bufferedReader.readLine().trim());
    
        int tax_percent = Integer.parseInt(bufferedReader.readLine().trim());
    
        Result.solve(meal_cost, tip_percent, tax_percent);
    
        bufferedReader.close();
    }
    

    }