-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
27 lines (20 loc) · 1.1 KB
/
Main.java
File metadata and controls
27 lines (20 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.company;
public class Main {
public static void main(String[] args) {
// Get all years divisible by 4 and 20
YearRange myFirstRange = new YearRange(1314, 2014);
myFirstRange.setRangeType(1);
// Get all leap years
YearRange mySecondRange = new YearRange(1100, 3150);
mySecondRange.setRangeType(2);
// Get all Olympic years divisible by 3
YearRange myThirdRange = new YearRange(1500, 3150);
myThirdRange.setRangeType(3);
System.out.println("List all years divisible by " + myFirstRange.getFirstDivisor() + " and " + myFirstRange.getSecondDivisor());
myFirstRange.printYears();
System.out.println("List all of the leap years between " + mySecondRange.getFirstYear() + " and " + mySecondRange.getSecondYear());
mySecondRange.printYears();
System.out.println("List of all Olympic years between " + myThirdRange.getFirstYear() + " and " + myThirdRange.getSecondYear() + " that are divisible by " + myThirdRange.getFirstDivisor());
myThirdRange.printYears();
}
}