Sort by

recency

|

3388 Discussions

|

  • + 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*

  • + 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*

  • + 0 comments

    JAVA

    `public static void solve(double meal, int tip, int tax) { double res1=(tip/100.0)*meal; double res2=(tax/100.0)*meal; System.out.println(Math.round(res1+res2+meal)); } }

    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();
    }
    

    }