الموضوع: برمجة
عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 24-12-2011, 07:14 PM   #5

Prince soma

Super Hussam

الصورة الرمزية Prince soma

 
تاريخ التسجيل: Sep 2011
التخصص: IT
نوع الدراسة: إنتظام
المستوى: الرابع
الجنس: ذكر
المشاركات: 266
افتراضي رد: برمجة

وهذه الة حاسبة بسيطة (جمع - طرح - ضرب - قسمة )


كود PHP:
package javaapplication93;

import java.util.Scanner;

public class 
JavaApplication93 {
public static 
void main(String[] args) {

Scanner input=new Scanner(System.in);

System.out.println("1-Addition");
System.out.println("2-subtraction");
System.out.println("3-multiplication");
System.out.println("4-Division");



System.out.println(" Enter you chose : ");
int chose=input.nextInt();

while(
chose || chose 4){
System.out.println(" wrong answer ........... enter again: "); 
chose=input.nextInt();
}

switch(
chose){
case 
1System.out.print(" Entre first number : ");
int z=input.nextInt();

System.out.print(" Entre second number : ");
int x=input.nextInt();

int sumx;

System.out.println(" The sum of number " " + " " number " x  " equal "  sum);

break;

case 
2System.out.print(" Entre first number : ");
int v=input.nextInt();

System.out.print(" Entre second number : ");
int b=input.nextInt();

int subtractionb;

System.out.println(" The subtraction of number " " - " " number " b  " equal "  subtraction);

break;

case 
3System.out.print(" Entre first number : ");
int l=input.nextInt();

System.out.print(" Entre second number : ");
int e=input.nextInt();

int multiplicatione;

System.out.println(" The multiplication of number " " * " " number " e  " equal "  multiplication);

break;

case 
4System.out.print(" Entre first number : ");
int k=input.nextInt();

System.out.print(" Entre second number : ");
int w=input.nextInt();

int Divisionw;

System.out.println(" The Division of number " " / " " number " w  " equal "  Division);

break;


}
}

 

Prince soma غير متواجد حالياً   رد مع اقتباس