- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise17.java
More file actions
Latest commit
17 lines (16 loc) · 517 Bytes
/
Copy pathExercise17.java
File metadata and controls
17 lines (16 loc) · 517 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// The following program has many bugs. Fix them all.
PublicstaticvoidMain(String[] args) { // Find the errors!
intmo = Integer.parseInteger(arg[0]);
intyr = Integer.parseInteger(args[2]);
intdays = uninitialized;
if (mo != 2) {
if (mo = 9 || 4 || 6 || 11) { days = 31;
elsedays = 30; }
} elseif (year % 4 == 0) && !(year % 100 == 0 &&
year % 400 != 0)
days = 29; /* hurray, leapyear!!
} else
days = 28;
System.Println("In year"+yr+" month "+mo+" has "+
days + " days");
}