Task Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal's total cost.

CSZONE


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

// Complete the solve function below.

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

double total = meal_cost+meal_cost*((tip_percent/100.0)+(tax_percent/100.0));

System.out.print((int) Math.round(total));

}

private static final Scanner scanner = new Scanner(System.in);

public static void main(String[] args) {

double meal_cost = scanner.nextDouble();

int tip_percent = scanner.nextInt();

int tax_percent = scanner.nextInt();

solve(meal_cost, tip_percent, tax_percent);

scanner.close();

}

}





Comments

Popular posts from this blog

HTML Signup Login Form With Source Code