Sort by

recency

|

3390 Discussions

|

  • + 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))));
        }
    
  • + 0 comments

    Python Code :

    def solve(meal_cost, tip_percent, tax_percent):

    # Write your code here
    
    print(round(meal_cost + ((tax_percent/100 ) * meal_cost) + ((tip_percent /100) * meal_cost)))
    
  • + 0 comments

    c++

    void solve(double meal_cost, int tip_percent, int tax_percent) {

    double newTip = static_cast<double>(tip_percent);
    double newTaxPercent = static_cast<double>(tax_percent);
    
    double taxAmount = newTip/100  * meal_cost;
    double tipAmount = newTaxPercent/100 * meal_cost;
    double totalAmount = tipAmount + taxAmount + meal_cost;
    
    cout << round(totalAmount) << endl;
    

    }

  • + 0 comments
     double result;
    double tip=(meal_cost*tip_percent)/100;
    double tax=(tax_percent*meal_cost)/100;
    result=meal_cost+tip+tax;
    int round_val=(int)Math.round(result);
    System.out.println(round_val);
    

    * Simple java code*