السلام عليكم ورحمة الله وبركاته
اعزائي المبرمجين انا لسى طالبه مبتدئه في تخصص البرمجه....وعندي هوم وورك وماقدرت اكمل الحل...وابي منكم تساعدوني في طريقة حله
والسؤال هو:
write a program that displays the following output on the screen:
*******************
* Coffee Machine *
* ---------------------*
* 1-Coffee. *
* 2-Capachino. *
* 3-Moka. *
* 4-Hot Chocolate . *
* 5-Tea. *
* 6 -Total price *
* 7-Exit *
*******************
please Enter your choice:
وفيه تحت هذا السؤال تعليمات وهي كالآتي:
-use SWITCH statement to check the choice 1,2,3,4,5,6 or 7 and calculate the price in each choice except"7"
-when the user selects option"1" your program displays"You Want Coffee,Coffee price is 3 SR",then add Coffee Price to total price.
-when the user selects option"2" your program displays "You Want Capachino,Capachino price is 5 SR ",then add Capachino Price to total price.
-when the user selects option"3" your program displays "You Want Moca,Moka price is 7 SR",then add Moka price to total price.
-when the user selects option"4" your program displays "You Want hot chocolate,hot chocolate price is 8 SR", then add hot chocolate price to total price.
-when the user selects option "5" your program displays "You Want Tea,tea price is 4 SR ", then add Tea price to total price.
-when the user selects option "6" your program displays "Total Price="+values of total price+"SR" .
-when the user selscts option "7" your program displays "End" and exit from the program.
HINTS: // use the following statement to read from the screen.
import java.util.Scanner;
int choice=0;
Scanner input=new Scanner(System.in);
choice=input.nextInt();
وانتهى السؤاااااااااااااااااال
وانا أود ان اريكم بدايه حل هذا السؤال يعني اللي قدرت عليه
v
v
v
v
public class CoffeMachine {
public static void main(String[] args) {
int choice=0;
do{
System.out.println("*******************");
System.out.println("* Coffee Machine *");
System.out.println("*--------------------- *");
System.out.println("* 1-Coffee. *");
System.out.println("* 2-Capachino. *");
System.out.println("* 3-Moka. *");
System.out.println("* 4-Hot Chocolate. *");
System.out.println("* 5-Tea. *");
System.out.println("* 6-Total price *");
System.out.println("* 7-Exit *");
System.out.println("*******************");
Scanner input=new Scanner(System.in);
choice=input.nextInt();
switch(choice){
case 1:
System.out.print("You Want Coffee,Coffee price is 3 SR");
break;
case 2:
System.out.print("You Want Capachino,Capachino price is 5 SR");
break;
case 3:
System.out.print("You Want Moca,Moka price is 7 SR");
break;
case 4:
System.out.print("You Want hot chocolate,hot chocolate price is 8 SR");
break;
case 5:
System.out.print("You Want Tea,tea price is 4 SR");
break;
case 6:
System.out.print("Total Price="+ values of total price="SR");
break;
case 7:
System.out.print("End");
break;} }
while(choice!=7); }
انا وصلت الى هنااااا واتوقع انه التكمله هو انه لازم نستخدم
آخر method
بس مو عارفه كيف اتمنى تفيدوووووني
وعلى فكره اتمنى الاقي حله منكم
خلاال اربعة ايام
ولكم مني جزيل الشكر والامتناااااااااااااان
ويعطيكم الف عاااااافيه
تقبلو خالص تحياتي