0% found this document useful (0 votes)
46 views3 pages

Java Barber Shop Pricing System

The document is a Java program for a barber shop that calculates the price of services based on customer input. It allows for three customers to enter their names and the type of service they require, then displays the price for each service. The program runs in a loop, allowing new customers to enter after the previous ones are processed.

Uploaded by

Houssein Mswi
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)
46 views3 pages

Java Barber Shop Pricing System

The document is a Java program for a barber shop that calculates the price of services based on customer input. It allows for three customers to enter their names and the type of service they require, then displays the price for each service. The program runs in a loop, allowing new customers to enter after the previous ones are processed.

Uploaded by

Houssein Mswi
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

Import [Link].

Scanner;

Public class BarberShop {

// Method ‫لحساب السعر‬

Public static int getPrice(int serviceType) {

Switch (serviceType) {

Case 1:

Return 10; // Haircut

Case 2:

Return 5; // Moustache

Case 3:

Return 13; // Both

Default:

Return 0;

Public static void main(String[] args) {

Scanner in = new Scanner([Link]);

String[] names = new String[3];

Int[] services = new int[3];

While (true) { // ‫لتكرار العملية لزبائن جدد‬


[Link](“=== Fill the 3 seats ===”);

// 1️⃣‫إدخال الزبائن‬

For (int I = 0; I < 3; i++) {

[Link](“Enter customer name: “);

Names[i] = [Link]();

[Link](“Service type (1-Haircut, 2-Moustache, 3-Both):


“);

Services[i] = [Link]();

[Link](“\n=== Barber starts working ===”);

// 2️⃣‫معالجة الزبائن‬

For (int I = 0; I < 3; i++) {

Int price = getPrice(services[i]);

[Link](

“Customer: “ + names[i] +

“ | Service: “ + services[i] +

“ | Price: $” + price

);

[Link](“\nAll customers finished. New customers can


enter.\n”);
}

You might also like