0% found this document useful (0 votes)
1 views5 pages

OriginalCode (Tutorial)

Uploaded by

Aung Kyaw Soe Oo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views5 pages

OriginalCode (Tutorial)

Uploaded by

Aung Kyaw Soe Oo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Hotel Print Invoice – Original Java Code

public class HotelInvoice {


public static void main(String[] args) {
String customer = "John Smith";
String roomType = "Deluxe Room";
double roomRate = 200;
int nights = 2;
double roomTotal = roomRate * nights;
double tax = roomTotal * 0.05; // 5% tax
double serviceCharge = roomTotal * 0.10; // 10% service charge
double finalAmount = roomTotal + tax + serviceCharge;
[Link]("========== HOTEL INVOICE ==========");
[Link]("Customer Name : " + customer);
[Link]("Room Type : " + roomType);
[Link]("Room Rate : $" + roomRate);
[Link]("Nights Stayed : " + nights);
[Link]("----------------------------------");
[Link]("Room Total : $" + roomTotal);
[Link]("Tax (5%) : $" + tax);
[Link]("Service (10%) : $" + serviceCharge);
[Link]("----------------------------------");
[Link]("Final Amount : $" + finalAmount);
[Link]("==================================\n");
}
}

Output
========== HOTEL INVOICE ==========
Customer Name : John Smith
Room Type : Deluxe Room
Room Rate : $200.0
Nights Stayed : 2
----------------------------------
Room Total : $400.0
Tax (5%) : $20.0
Service (10%) : $40.0
----------------------------------
Final Amount : $460.0
==================================

[Link] (Original Code)


public class OnlineBusTicketInvoice {

public static void main(String[] args) {

// Ticket details
String bookingId = "BT-20260217-001";
String passengerName = "Ei Theint Theint Thu";
String busOperator = "Shwe Mandalay Express";
String from = "Yangon";
String to = "Magway";
String journeyDate = "20-Feb-2026";
String departureTime = "08:30 AM";
int seatCount = 2;
double pricePerSeat = 33000;

// Calculations
double subtotal = seatCount * pricePerSeat;
double serviceFee = subtotal * 0.02; // 2% service fee
double tax = subtotal * 0.05; // 5% tax
double totalAmount = subtotal + serviceFee + tax;

// Print Invoice
[Link]("========== ONLINE BUS TICKET INVOICE
==========");
[Link]("Booking ID : " + bookingId);
[Link]("Passenger Name : " + passengerName);
[Link]("Bus Operator : " + busOperator);
[Link]("From : " + from);
[Link]("To : " + to);
[Link]("Journey Date : " + journeyDate);
[Link]("Departure Time : " + departureTime);
[Link]("-----------------------------------------------");
[Link]("Price per Seat : " + pricePerSeat);
[Link]("Number of Seats : " + seatCount);
[Link]("Subtotal : " + subtotal);
[Link]("Service Fee(2%) : " + serviceFee);
[Link]("Tax (5%) : " + tax);
[Link]("-----------------------------------------------");
[Link]("Total Amount : " + totalAmount);

[Link]("=========================================
======");
}
}

Output
========== ONLINE BUS TICKET INVOICE ==========
Booking ID : BT-20260217-001
Passenger Name : Ei Theint Theint Thu
Bus Operator : Shwe Mandalay Express
From : Yangon
To : Magway
Journey Date : 20-Feb-2026
Departure Time : 08:30 AM
-----------------------------------------------
Price per Seat : 33000.0
Number of Seats : 2
Subtotal : 66000.0
Service Fee(2%) : 1320.0
Tax (5%) : 3300.0
-----------------------------------------------
Total Amount : 70620.0
===============================================

You might also like