Sort by

recency

|

3393 Discussions

|

  • + 0 comments

    JavaScript Code of Day 3

    function solve(meal_cost, tip_percent, tax_percent) { // Write your code here

    let tip= (meal_cost/100) * tip_percent; let tax= (tax_percent/100) * meal_cost;

    let total_cost = Math.round(meal_cost + tip+ tax); console.log(total_cost);

  • + 0 comments
    def solve(meal_cost, tip_percent, tax_percent):
        tip=(meal_cost/100)*tip_percent
        tax=(tax_percent/100)*meal_cost
        t=round(meal_cost+tax+tip)
        print(t)
    
  • + 0 comments

    Kotlin

    fun solve(meal_cost: Double, tip_percent: Int, tax_percent: Int): Unit {
        // Write your code here
    
        val tipPrice = tip_percent*0.01*meal_cost
        val taxPrice = tax_percent*0.01*meal_cost
        
        println(Math.round(meal_cost + tipPrice + taxPrice))
    }
    
  • + 0 comments

    C# code: double usertips =meal_cost /100.0 * tip_percent; double usertax = tax_percent/100.0 * meal_cost;

        double mealtotalcost = meal_cost +usertips +usertax;
        Console.WriteLine(Math.Round(mealtotalcost));
    
  • + 0 comments
    public static void solve(double meal_cost, int tip_percent, int tax_percent) {
            System.out.printf("%.0f", meal_cost + ((meal_cost * (tip_percent / 100f)) + (meal_cost * (tax_percent / 100f))));
        }