Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class tipCalculator {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String play = "yes";
- while(play.equals("yes")) {
- System.out.println("Please enter the Total of Bill: ");
- double bill = sc.nextDouble();
- System.out.println("What percent would you like to tip: ");
- double tip = sc.nextInt();
- double tipTotal= bill*(tip/100);
- System.out.println("Your tip was: "+tipTotal);
- double total = bill+tipTotal;
- System.out.println("Your total was: "+total);
- System.out.println("How many people are splitting the bill? ");
- int split = sc.nextInt();
- double perP = total/split;
- System.out.println("Each person needs to pay: "+perP);
- System.out.println("Play again? yes or no");
- sc.nextLine();
- play = sc.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement