Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class tipCalculator {
  3.  
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. String play = "yes";
  7. while(play.equals("yes")) {
  8. System.out.println("Please enter the Total of Bill: ");
  9. double bill = sc.nextDouble();
  10. System.out.println("What percent would you like to tip: ");
  11. double tip = sc.nextInt();
  12. double tipTotal= bill*(tip/100);
  13. System.out.println("Your tip was: "+tipTotal);
  14. double total = bill+tipTotal;
  15. System.out.println("Your total was: "+total);
  16. System.out.println("How many people are splitting the bill? ");
  17. int split = sc.nextInt();
  18. double perP = total/split;
  19. System.out.println("Each person needs to pay: "+perP);
  20. System.out.println("Play again? yes or no");
  21. sc.nextLine();
  22. play = sc.nextLine();
  23. }
  24.  
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement