كود PHP:
package ha_1535272_p3;
import java.util.Scanner;
import static jdk.nashorn.internal.objects.NativeString.toUpperCase;
public class HA_1535272_P3 {
public static void main(String[] args) {
String e,r,a,b,c,d,g,h,i,j,k;
Scanner fares =new Scanner(System.in);
do {
//
System.out.println("--------------------------------------------------------------------------------");
System.out.println("------ Welcome to Jeddah AUTOMALL Customer e-Portal ------");
System.out.println("--------------------------------------------------------------------------------");
//
System.out.println("| 1 : Get information about the vehicles available for sale | ");
System.out.println("| 2 : Make appointments for different types of services (sales or maintenance)| ");
System.out.println("| 3 : Submit customer feedback or complaint | ");
System.out.println("| 4 : Exit | ");
System.out.println(" ------------------------------------------------------------------------------- ");
//
System.out.print(" > Please enter your choice : ");
int f = fares.nextInt();
if (f >= 1 && f <=3 ){
}
else if (f==4){{System.exit(0);}
}
else {
System.out.println(" Invalid Input!!! Please Try Again ..... ");
continue;
}
if (f == 1 ){
while(true){
System.out.println("");
System.out.println(" ------ COMPANIES ------");
System.out.println("---------------------------------");
System.out.println(" | T or t : Toyota | ");
System.out.println(" | C or c : Chevrolet | ");
System.out.println(" | G or g : GMC | ");
System.out.println(" | K or k : Kia | ");
System.out.println(" | R or r : Return to Main Menu | ");
System.out.println(" -------------------------------- ");
System.out.print(" > Please enter the choice: ");
e = fares.next();
switch (e.toLowerCase().charAt(0)){
case 'r':if (e.equalsIgnoreCase("r"))
{
break;
}
case 't':
while (true) {
System.out.println(" ------ VEHICLES ------ ");
System.out.println("---------------------------------");
System.out.println(" | L or l: Land Cruiser 2015 | ");
System.out.println(" | S or s: Sequoia 2015 | ");
System.out.println(" | F or f: FJ Cruiser 2015 | ");
System.out.println(" | R or r: Previous Menu | ");
System.out.println(" --------------------------------");
System.out.print(" > Please enter the choice: ");
e = fares.next();
if (e.equalsIgnoreCase("l")){
final double ff = 175000.0 ;
final int fa = 8;
System.out.println(" > Price: "+ ff);
System.out.println(" > Quantity Available:"+fa);
}
else if (e.equalsIgnoreCase("s")){
final double n = 140000.0 ;
final int nn = 8;
System.out.println(" > Price: "+ n);
System.out.println(" > Quantity Available:"+nn);
}
else if (e.equalsIgnoreCase("f")){
final double v = 120000.0 ;
final int vv = 6;
System.out.println(" > Price: "+ v);
System.out.println(" > Quantity Available:"+vv);
}
else if (e.equalsIgnoreCase("r"))
{
break;
}
else {
System.out.println("");
System.out.println(" Invalid Input!!! Please Try Again ..... ");
{continue;}
}
}
break;
case 'c':
while (true) {
System.out.println("");
System.out.println(" ------ VEHICLES ------ ");
System.out.println("---------------------------------");
System.out.println(" | S or s: Suburban 2015 | ");
System.out.println(" | T or t: Tahoe 2015 | ");
System.out.println(" | Z or z: Trailblazer 2015 | ");
System.out.println(" | R or r: Previous Menu | ");
System.out.println(" --------------------------------");
System.out.print(" > Please enter the choice: ");
e = fares.next();
if (e.equalsIgnoreCase("s")){
final double ff = 150000.0 ;
final int fa = 6;
System.out.println(" > Price: "+ ff);
System.out.println(" > Quantity Available:"+fa);
}
else if (e.equalsIgnoreCase("t")){
final double n = 135000.0 ;
final int nn = 8;
System.out.println(" > Price: "+ n);
System.out.println(" > Quantity Available:"+nn);
}
else if (e.equalsIgnoreCase("z")){
final double v = 100000.0 ;
final int vv = 4;
System.out.println(" > Price: "+ v);
System.out.println(" > Quantity Available:"+vv);
}
else if (e.equalsIgnoreCase("r"))
{
break;
}
else {
System.out.println("");
System.out.println(" Invalid Input!!! Please Try Again ..... ");
{continue;}
}
}
break;
case 'g':
while (true) {
System.out.println("");
System.out.println(" ------ VEHICLES ------ ");
System.out.println("---------------------------------");
System.out.println(" | Y or y: Yukon 2015 | ");
System.out.println(" | A or a: Acadia 2015 | ");
System.out.println(" | T or t: Terrain 2015 | ");
System.out.println(" | R or r: Previous Menu | ");
System.out.println(" --------------------------------");
System.out.print(" > Please enter the choice: ");
e = fares.next();
if (e.equalsIgnoreCase("y")){
final double ff = 120000.0 ;
final int fa = 8;
System.out.println(" > Price: "+ ff);
System.out.println(" > Quantity Available:"+fa);
}
else if (e.equalsIgnoreCase("t")){
final double n = 150000.0 ;
final int nn = 6;
System.out.println(" > Price: "+ n);
System.out.println(" > Quantity Available:"+nn);
}
else if (e.equalsIgnoreCase("z")){
final double v = 105000.0 ;
final int vv = 6;
System.out.println(" > Price: "+ v);
System.out.println(" > Quantity Available:"+vv);
}
else if (e.equalsIgnoreCase("r"))
{
break;
}
else {
System.out.println("");
System.out.println(" Invalid Input!!! Please Try Again ..... ");
{continue;}
}
}
break;
case 'k':
while (true) {
System.out.println("");
System.out.println(" ------ VEHICLES ------ ");
System.out.println("---------------------------------");
System.out.println(" | M or m: Mohave 2015 | ");
System.out.println(" | S or s: Sorento 2015 | ");
System.out.println(" | P or p: Sportage 2015 | ");
System.out.println(" | R or r: Previous Menu | ");
System.out.println(" --------------------------------");
System.out.print(" > Please enter the choice: ");
e = fares.next();
if (e.equalsIgnoreCase("m")){
final double ff = 97000.0 ;
final int fa = 6;
System.out.println(" > Price: "+ ff);
System.out.println(" > Quantity Available:"+fa);
}
else if (e.equalsIgnoreCase("s")){
final double n = 77000.0 ;
final int nn = 4;
System.out.println(" > Price: "+ n);
System.out.println(" > Quantity Available:"+nn);
}
else if (e.equalsIgnoreCase("z")){
final double v = 67000.0 ;
final int vv = 6;
System.out.println(" > Price: "+ v);
System.out.println(" > Quantity Available:"+vv);
}
else if (e.equalsIgnoreCase("r"))
{
break;
}
else {
System.out.println("");
System.out.println(" Invalid Input!!! Please Try Again ..... ");
{continue;}
}
}
break;
default:
System.out.println("");
System.out.println(" Invalid Input!!! Please Try Again ..... ");
{continue;}
}
}
}
if (f == 2 ){
while(true){
System.out.println("");
System.out.println(" ------ COMPANIES ------");
System.out.println("---------------------------------");
System.out.println(" | T or t : Toyota | ");
System.out.println(" | C or c : Chevrolet | ");
System.out.println(" | G or g : GMC | ");
System.out.println(" | K or k : Kia | ");
System.out.println(" | R or r : Return to Main Menu | ");
System.out.println(" -------------------------------- ");
System.out.print(" > Please enter the choice: ");
e = fares.next();
switch (e.toLowerCase().charAt(0)){
case ('t'):
while (true) {
System.out.println(" ---- APPOINTMENT TYPE ---- ");
System.out.println("---------------------------------");
System.out.println(" | 1: Service Appointment | ");
System.out.println(" | 2: Sales Appointment | ");
System.out.println(" | 3: Previous Menu | ");
System.out.println(" --------------------------------");
System.out.print(" > Please enter the choice: ");
e = fares.next();
if (e.equalsIgnoreCase("1")){
System.out.print("> Enter your name (first and last): ");
e = fares.next();
r = fares.next();
System.out.print("> Enter your mobile (##-###-####): ");
System.out.print("> Enter vehicle make and model: ");
a = fares.next();
b = fares.next();
System.out.print("> Enter mileage: ");
c = fares.next();
System.out.print("> Enter service description: ");
d = fares.next();
g = fares.next();
System.out.print("> When do you want your service appointment: ");
h = fares.next();
i = fares.next();
j = fares.next();
System.out.println("");
System.out.println("---------------------------------------------------------------------------------");
System.out.println("| Yor request was received; you will be contacted within 24 hours to finalize it. |");
System.out.println("---------------------------------------------------------------------------------");
System.out.println("Here is a confirmation of your request to Toyota: ");
System.out.println(" Appointment Type: Service");
System.out.println(" Name : "+(toUpperCase(e+" "+r))+" Phone: ");
System.out.println(" Make and model of your vehicle: "+(a+" "+b));
System.out.println(" Mileage: "+c);
System.out.println(" Service needed: "+(d+" "+g));
System.out.println(" Preferred date for Sales appointment:"+(h+" "+i+" "+j));
System.out.println("");
System.out.println(" **You will now be returned to the Appointment Menu.");
}
if (e.equalsIgnoreCase("2")){
System.out.print("> Enter your name (first and last): ");
e = fares.next();
r = fares.next();
System.out.print("> Enter your mobile (##-###-####): ");
System.out.print("> Which make and model are you interested in: ");
a = fares.next();
b = fares.next();
System.out.print("> How many vehicles are you wanting to purchase: ");
c = fares.next();
System.out.print("> When do you want your service appointment: ");
h = fares.next();
i = fares.next();
j = fares.next();
System.out.println("");
System.out.println("---------------------------------------------------------------------------------");
System.out.println("| Yor request was received; you will be contacted within 24 hours to finalize it. |");
System.out.println("---------------------------------------------------------------------------------");
System.out.println("Here is a confirmation of your request to Toyota: ");
System.out.println(" Appointment Type: Sales");
System.out.println(" Name : "+(toUpperCase(e+" "+r))+" Phone: ");
System.out.println(" Make and model you are interested in: "+(a+" "+b));
System.out.println(" Number of vehciles planning to purchase: "+c);
System.out.println(" Preferred date for Sales appointment:"+(h+" "+i+" "+j));
System.out.println("");
System.out.println(" **You will now be returned to the Appointment Menu.");
}
else if (e.equalsIgnoreCase("3"))
{
break;
}
else {
System.out.println("");
System.out.println(" Invalid Input!!! Please Try Again ..... ");
{continue;}
}
} break;
default:
System.out.println("");
System.out.println(" Invalid Input!!! Please Try Again ..... ");
{continue;}
}
}
}
}while(true);
}
}
السلام عليكم ورحمة الله
ياليت لو أحد منكم يقدر يساعدني و يشرح لي هالبروجيكت لان حايس فيه 1- ماعرفت كيف اخليه يرجع للقائمة الرئسية 2-ماعرفت لل exit اللي هيا تحسب كل اللي دخلتو ويطلعو في جدول و يتقفل البرنامج 3- واخر نقطة للمتغيرات اللي هيا حق (####-###-##) الجوال والمتغيرات اللي تحت الجوال مني عارف كيف اخلي المستخدم يكتب اللي يبغاه مثلا اقعد اخليه يكتب اذا ظغط انتر ينتقل للمدخل التالي , اتمنى الفزعة ياشباب
الكود اللي ارسلتو ماهو كامل بس اتمنى توضيح للثلاثة نقاط بس .
راح أكون شاكر لكم