Java #51: Tip Calculator/ Splitter Program in Java


//——————–Full Source Code—————-//

//Programmer:Akinwale Owi
//Company: Dagba Computers
//Program Purpose: Tip Calculator/Splitter

package javaapplication38;

import java.util.Scanner;

public class JavaApplication38 {

public static void main(String[] args)
//Scanner that will read users input
Scanner input = new Scanner (;

//Asking user for total number of People
System.out.printf(“Please enter the number of people(including you): “);

//Reading in the number of People
double pplNum = input.nextDouble();

//Asking user for Total Bill
System.out.printf(“Please enter the total cost of the meal: $” + “\n”);

//Reading in the user’s input
double totalBill = input.nextDouble();

//Printing out input to test
System.out.printf(“The total bill cost: $” + totalBill + “\n”);

//Creating standard tip percentage
double tipPercent = 0.15;

//Calculating the Total Tip
double totalTip = totalBill * tipPercent;

//Printing out the Total Tip
System.out.printf(“The Total Tip: $” + totalTip + “\n”);

//Calculating the Tip per Person
double perGuest = totalTip / pplNum;

//Printing out the Tip per Person to Test
System.out.printf(“Tip per Person = $” + perGuest + “\n”);

//End of the Main Function

}//End of only Class

//—————–End of Program——————–//

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: