Home Tutorial Java Core Cyber Cafe Billing Application in Java

 
 

Cyber Cafe Billing Application in Java
Posted on: February 13, 2010 at 12:00 AM
In this section, we are going to create a billing application of Cyber Cafe in Java.

Cyber Cafe Billing Application in Java

In this section, we are going to create a bill of Cyber Cafe. Now to create this bill, we have allowed the user to enter the number of hours he/she worked. And then according to the following Slab System, we have calculated the payable amount.

For the first 60 minutes - Rs. 20/=
For the next 30 minutes - Rs. 12/=
For the next 15 minutes - Rs. 8/=
For the rest minutes ? Rs. 2/min

Here is the code:

import java.util.*;

class CountPalindromes {

	public static void main(String[] args) {
		int count = 0;
		Scanner input = new Scanner(System.in);
		System.out.print("Enter sentence: ");
		String str = input.nextLine();
		StringTokenizer stk = new StringTokenizer(str);
		while (stk.hasMoreTokens()) {
			String words = stk.nextToken();
			StringBuffer sb = new StringBuffer(words);
			String reversedWords = sb.reverse().toString();
			if (words.equalsIgnoreCase(reversedWords)) {
				count++;
			}
		}
		System.out.println("Number of Palindromes in the specified string: "+ count);
	}
}

Output:

Enter Name: Anusmita
Enter number of hours: 3
*****Cyber Cafe*****
Name: Anusmita
You have worked :180 minutes
For the first 60 minutes - Rs. 20/
For the next 30 minutes - Rs. 12/
For the next 15 minutes - Rs. 8/
For the rest 75 minutes(Rs 2/min) - Rs150/
Pay: 190

Related Tags for Cyber Cafe Billing Application in Java:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.