This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$crypto = @" | |
P k T r 2 s z 2 * c F - | |
r a z 7 G u D 4 w 6 U # | |
g c t K 3 E @ B t 1 a Y | |
Q P i c % 7 0 5 Z v A e | |
W 6 j e P R f p m I ) H | |
y ^ L o o w C n b J d O | |
S i 9 M b e r # ) i e U | |
* f 2 Z 6 M S h 7 V u D | |
5 a ( h s v 8 e l 1 o W |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SpeedConverter { | |
public static long toMilesPerHour(double kilometersPerHour){ | |
if (kilometersPerHour <0) { | |
return -1; | |
} | |
return Math.round(kilometersPerHour/1.609); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MegaBytesConverter { | |
public static void printMegaBytesAndKiloBytes(int kiloBytes){ | |
if (kiloBytes < 0){ | |
System.out.println("Invalid Value"); | |
} else { | |
int megabytes = (kiloBytes/1024); | |
int kiloRemainder = kiloBytes%1024; | |
System.out.println(kiloBytes+" KB = "+megabytes+" MB and "+kiloRemainder+" KB"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BarkingDog { | |
public static boolean shouldWakeUp(boolean barking,int hourOfDay){ | |
if (hourOfDay <0 || hourOfDay >23){ | |
return false; | |
} | |
if (barking == true && hourOfDay <8 || hourOfDay >22){ | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LeapYear { | |
public static boolean isLeapYear(int year) { | |
if (year < 1 || year > 9999) { | |
return false; | |
} | |
if (year % 4 == 0) { | |
if (year % 100 == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// numbers must be equal up to 3 decimal places | |
public class DecimalComparator { | |
public static boolean areEqualByThreeDecimalPlaces(double first,double second) { | |
if (first <0 && second >0 || first >0 && second <0){ | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EqualSumChecker { | |
public static boolean hasEqualSum (int a, int b, int c) { | |
if (a+b==c){return true;} | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TeenNumberChecker { | |
public static boolean hasTeen(int a,int b,int c){ | |
if (a >=13 && a <=19 || | |
b >=13 && b <=19 || | |
c >=13 && c <=19 ) { | |
return true; | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AreaCalculator { | |
public static double area (double radius) { | |
if (radius<0) { | |
return -1.0d; | |
} | |
double areaOfCircle = ((Math.PI * (radius*radius))); | |
return areaOfCircle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MinutesToYearsDaysCalculator { | |
public static void printYearsAndDays(long minutes){ | |
if (minutes <0) { | |
System.out.println("Invalid Value"); | |
} else { | |
long years = minutes / 525600; | |
long minutesRemaining = (minutes - (years * 525600)); | |
long daysRemaining = minutesRemaining / 1440; |
OlderNewer