0% found this document useful (0 votes)
4 views1 page

Tab Spliter Script

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Tab Spliter Script

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

Scanner;
public class TabSplitter {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//welcome message
System.out.println("Welcome to Tab Splitter!");
System.out.println("This program will calculate the total bill plus the tip,
");
System.out.println("and divide the amount among the customers at the
table.");

System.out.println("What is the total bill amount? "); //collect bill amount


double billAmount = scan.nextDouble();

System.out.println("What percentage would you like to tip? "); //ask for


percentage of tip
int tipPercentage = scan.nextInt();

System.out.println("How many people are sharing the bill? "); //ask for
amount of people sharing bill
int customers = scan.nextInt();

double tipAmount = (billAmount/100) * tipPercentage; //divide bill amount by


100
double totalAmount = billAmount + tipAmount; //add total amount with tip
amount
double amountPerPerson = totalAmount / customers; //divide bill amount by
customers

System.out.println("Bill:" + billAmount);
System.out.println("Tip:" + tipPercentage);
System.out.println("Total with Tip:" + totalAmount);
System.out.println("Each person owes:" + amountPerPerson);
}
}

You might also like