Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CalendarSwitch {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int year=1904;
- String month="Februar";
- //Überprüfung: Schaltjahr
- boolean sj = (year%4 == 0 && (year%100 != 0 || year%400 == 0));
- //Überprüfung: Schaltjahr ENDE
- //Teil: Monat
- if(month=="April"||month=="Juni"||month=="September"||month=="November"){
- System.out.println("Dieser Monat hat 30 Tage");
- }
- else if(month=="Januar"||month=="Maerz"||month=="Mai"||month=="Juli"||month=="August"||month=="Oktober"||month=="Dezember"){
- System.out.println("Dieser Monat hat 31 Tage");
- }
- else if(month=="Februar"){
- if(sj==false){
- System.out.println("Dieser Monat hat 28 Tage");
- }
- else{
- System.out.println("Dieser Monat hat 29 Tage");
- }
- }
- else{
- System.out.println("Ihre Eingabe ist falsch!");
- }
- //Teil: Monat ENDE
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement