مثال N1 مبانی کامپیوتر و برنامه سازی
************************************************
N1:
import java.util.*;
public class first {
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
int x, price;
System.out.print("Please enter WAT: ");
x=input.nextInt();
switch (x)
{
case 40:
price=1200;
System.out.println("\n Gheymat="+price);
break;
case 60:
price=1500;
System.out.println("\n Gheymat="+price);
break;
case 80:
price=2000;
System.out.println("\n Gheymat="+price);
break;
case 120:
price=2800;
System.out.println("\n Gheymat="+price);
break;
case 160:
price=3200;
System.out.println("\n Gheymat="+price);
break;
case 200:
price=4000;
System.out.println("\n Gheymat="+price);
break;
default:
System.out.println("Meghdare vared shode sahih nist.");
}
}
}
+ نوشته شده در دوشنبه سی و یکم اردیبهشت ۱۳۹۷ ساعت 17:28 توسط حسن دانا
|