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”);
}