Oop Assignment #2: Submitted By: Adnan Haider Reg No. Sp20-Bse-037
Oop Assignment #2: Submitted By: Adnan Haider Reg No. Sp20-Bse-037
3 return true;
4 if (!(isWeekend) && cigars >=40 && cigars <= 60)
5 return true;
6 else
7 return false;
8}
07 else
08 return 2;
09 } else if (speed <=65)
10 return 0;
11 else if (speed > 65 && speed <= 85)
12 return 1;
13 else
14 return 2;
15 }
Logic 3: Love6
01 public boolean love6(int a, int b) {
02 if (a == 6 || b == 6)
03 return true;
04
05 int sum = a+b;
06 int diff = Math.abs(a-b);
07
08 if (sum == 6 || diff == 6)
09 return true;
10 else
11 return false;
12 }
Logic 4: morethan20
1 public boolean more20(int n) {
2 return (n % 20) == 1 || (n % 20) == 2;
3}
Logic 5: near10
1 public boolean nearTen(int num) {
2 if (num % 10 < 3 || num % 10 >=8)
3 return true;
4 else return false;
5}
Logic 6: Teaparty
1 public int teaParty(int tea, int candy) {
2 if (tea < 5 || candy < 5)
3 return 0;
4 if ((tea >= 2 * candy) || (candy >= 2 * tea))
5 return 2;
6 else
7 return 1;
8}
Logic 7: TwoAsone
1 public boolean twoAsOne(int a, int b, int c) {
2 if ( a + b == c || c + b == a || c + a == b)
3 return true;
4 else
5 return false;
6 }
Logic 8: LastDigit
01 public boolean lastDigit(int a, int b, int c) {
02 int modA = a % 10;
03 int modB = b % 10;
04 int modC = c % 10;
05
06 if (modA == modB || modA == modC || modB == modC)
07 return true;
08 else
09 return false;
10 }
Logic 9: maxMod5
1 public int maxMod5(int a, int b) {
2 if (a == b)
3 return 0;
4
}
Logic 12: TeenSum
1 public int teenSum(int a, int b) {
2 int sum = a+b;
3 if ((a >= 13 && a <= 19) || (b >= 13 && b <= 19))
4 return 19;
5 else
6 return sum;
7}
09 else
10 return false;
11 }
Logic 15: sumLimit
public int sumLimit(int a, int b) {