Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ConditionTask;
- public class ActivityRecorder {
- public static int activityRecorder(String[] activities, int year) {
- int total = 0;
- for (String activity : activities) {
- if (activity == "TypeA") {
- total += 20;
- }
- if (activity == "TypeC") {
- total += 13;
- }
- if (activity == "TypeE" || activity == "TypeG" || activity == "TypeH") {
- total += 7;
- }
- if (activity == "TypeJ" || activity == "TypeL") {
- total += 3;
- }
- if (activity == "TypeD" || activity == "TypeF") {
- total += 10;
- }
- if (activity == "TypeI" || activity == "TypeK") {
- total += 9;
- }
- if (activity == "TypeB") {
- if (((year % 4 == 0) && !(year % 100 == 0)) || (year % 400 == 0))
- total += 3;
- else
- total += 2;
- }
- if (activity != "TypeA" && activity != "TypeB" && activity != "TypeC" && activity != "TypeD"
- && activity != "TypeE" && activity != "TypeF" && activity != "TypeG" && activity != "TypeH"
- && activity != "TypeI" && activity != "TypeJ" && activity != "TypeK" && activity != "TypeL") {
- total = 20;
- }
- }
- return total;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement