Skip to content

Commit c9ff319

Browse files
committed
Error fixed as per comment and input as used
1 parent 765ad9b commit c9ff319

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

01Day1/Task/Solution1.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
import java.util.Scanner;
2+
13
public class Arithmetic {
4+
25
public static void main(String[] args)
36
{
4-
double mealcost=12.00;
5-
int tipPercent=20;
6-
int taxPercent=8;
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
711

12+
//Calculations for bill amount
813
double tip=((mealcost*tipPercent)/100);
914
double tax=((mealcost*taxPercent)/100);
10-
int totalcost=tip+tax+mealcost;
11-
System.out.print(totalcost);
15+
int totalcost=(int) (tip+tax+mealcost) ;
16+
System.out.println("Your total bill is of:"+totalcost);
1217
}
1318
}
1419

0 commit comments

Comments
 (0)