# Day 2: Operators – 30 Days Of code HackerRank

0
20 Day 2: Operators – 30 Days Of code HackerRank

Today we are going to solve a Operators program of day 2, from HackerRank challenge- 30 Days of code in java with complete code and explanation.

Question:

In this question, we will work with arithmetic operators of java that will help you to complete the series of HackerRank 30 Days of code.

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. Round the result to the nearest integer.

Note: If you are using a language that doesn’t support using + for string concatenation (e.g.: C), you can just print one variable immediately following the other on the same line. The string provided in your editor must be printed first, immediately followed by the string you read as input.

Note:  Be sure to use precise values for your calculations, or you may end up with an incorrectly rounded result.

Function Description:

Complete the solve function in the editor below.

solve has the following parameters:

• int meal_cost: the cost of food before tip and tax
• int tip_percent: the tip percentage
• int tax_percent: the tax percentage

Returns The function returns nothing. Print the calculated value, rounded to the nearest integer.

Solution in Java:

``````// Shivam Sahu
// https://www.techy360.tech/

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

class Result {

/*
* Complete the 'solve' function below.
*
* The function accepts following parameters:
*  1. DOUBLE meal_cost
*  2. INTEGER tip_percent
*  3. INTEGER tax_percent
*/

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

}

}

public class Solution {
public static void main(String[] args) throws IOException {