+
۳

برنــــــــــــامه نویسی تمرکز - مشکل در این برنامه چیست جاوا (اینجا کلیک کنید)

برنــــــــــــامه نویسی تمرکز - مشکل در این برنامه چیست جاوا

این برنامه ای است که سال و روز و ماه را میگیره و مشخص میکنه اون تاریخی که بش دادی چند شنبس
این دستوراتی ست که بنده به زبان جاوا در نت بینز نوشتم
ولی خطای منطقی داره و وارد دستور sweitch نمیشه

import java.util.Scanner;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author sara
*/
public class yeardaymounth {
public static void main(String[] args) {
int h,q,m,k,j,y;
/*h=chan shanbas?
* q=day rooz
* m=mounth mah
* k=sal%7
* j=gharn
* y=year
*/
Scanner H=new Scanner(System.in);

System.out.println("please enter the day : ");
q=H.nextInt();

System.out.println("pleas enter the mounth : ");
m=H.nextInt();

System.out.println("pleas enter year: ");
y=H.nextInt();
k=y%7;
j=y/400;
// System.out.println("pleas enter J : ");

h=(q+(26*(m+1)/10)+k+(k/4)+(j/4)+5*j)%7;

System.out.println("h = "+h);
String name="";

switch(h){
case 1:
name="shanbe";
break;
case 2:
name="yek shanbe";
break;
case 3:
name="do shanbe";
break;
case 4:
name="se shanbe";
break;
case 5:
name="chahar shanbe";
break;
case 6:
name="panj shanbe";
break;
default:
name="jome";
}
}

}

 

رای دهندگان

دیدگاهتان را بنویسید