Skip to content

Commit 95e1074

Browse files
author
Harshil bhardwaj
authored
Merge pull request #5 from Pranit5895/pranit
Solution of task1.java
2 parents f58abd7 + c9ff319 commit 95e1074

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

01Day1/Task/Arithmetic.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
public class Arithmetic {
2+
3+
public static void main(String[] args) {
4+
Scanner scan = new Scanner(System.in);
5+
double mealCost = scan.nextDouble(); // original meal price
6+
int tipPercent = scan.nextInt(); // tip percentage
7+
int taxPercent = scan.nextInt(); // tax percentage
8+
scan.close();
9+
10+
// Write your calculation code here.
11+
double tip= ((mealCost*tipPercent)/100);
12+
double tax=((mealCost*taxPercent)/100);
13+
double numberToRoundHere= tip + tax + mealCost;
14+
15+
// cast the result of the rounding operation to an int and save it as totalCost
16+
int totalCost = (int) Math.round(numberToRoundHere);
17+
18+
// Print your result
19+
System.out.printf("The total meal cost is %d dollars.",totalCost);
20+
}
21+
}

01Day1/Task/Solution1.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.util.Scanner;
2+
3+
public class Arithmetic {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner scan=new Scanner(Systen.in);
8+
double mealcost=scan.nextDouble(); //orignal mealcost
9+
int tipPercent=scan.nexInt(); //tip percent
10+
int taxPercent=scan.nextInt(); //tax percent
11+
12+
//Calculations for bill amount
13+
double tip=((mealcost*tipPercent)/100);
14+
double tax=((mealcost*taxPercent)/100);
15+
int totalcost=(int) (tip+tax+mealcost) ;
16+
System.out.println("Your total bill is of:"+totalcost);
17+
}
18+
}
19+

0 commit comments

Comments
 (0)