1. Project Overview
• Project Title: Coffee Ordering System in Java
• Developed By: Kanak Kumar
• This Java console-based program allows users
to order different types of coffee with optional
additions like whipped cream and flavors,
calculates the bill including tax, and accepts
user rating at the end.
2. Class and Method Introduction
• public class CoffeeOrderingSystem2 {
• - Defines the main class of the program.
• - Class contains methods for cream addition,
flavor selection, and main order logic.
3. Method - cream()
• int cream() {
• Scanner scanner = new Scanner(System.in);
• ...
• return c == 1 ? 30 : 0;
• }
• - Takes user input: Do they want whipped
cream?
• - If yes (1), adds ₹30 to the bill.
5. main() Method Begins
• public static void main(String[] args) {
• CoffeeOrderingSystem2 t = new
CoffeeOrderingSystem2();
• Scanner scanner = new Scanner(System.in);
• - Creates object t to access non-static
methods.
• - Scanner initialized for input.
• - Displays welcome message.
6. Coffee Selection Menu
• do {
• System.out.println("choose your coffee...");
• choice = scanner.nextInt();
• } while(choice > 11 || choice < 0);
• - Menu-driven coffee selection using a do-
while loop.
• - Validates user input between 1 to 11.
7. Coffee Choice Handling (Switch)
• switch(choice) {
• case 1 -> {
• System.out.println("LATTE");
• bill += 200;
• bill += t.cream();
• bill += t.flavor();
• }
• ...
• }
8. Tax Calculation and Final Bill
• double taxbill = 0;
• if(bill > 0) {
• taxbill = bill + (0.18 * bill);
• System.out.println("Total bill = " + taxbill);
• }
• - If a valid coffee was selected, adds 18% GST
to the bill.
9. User Rating & Feedback
• System.out.println("Rate us 0 to 5");
• int r = scanner.nextInt();
• for(int i = 1; i <= r; i++) {
• System.out.println("* ");
• }
• - Takes rating input.
• - Displays stars (*) according to user feedback.
10. Final Summary
• ✅ Object-Oriented Design
• ✅ Scanner for User Input
• ✅ switch-case & if-else usage
• ✅ Looping (do-while, for)
• ✅ GST Calculation
• ✅ Real-world simulation in console
• Developed by: Kanak Kumar