Skip to content

Instantly share code, notes, and snippets.

View johnkamara's full-sized avatar

johnkamara

View GitHub Profile
@johnkamara
johnkamara / gist:1ed37b29bb3ff4ab18b2a6d0c2ebed49
Created March 10, 2021 21:43 — forked from 0ryant/gist:5d6d0809df8e9ec9234a7c9f50264a98
Java - Coding Challenge 2 - MegaBytes Converter
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");
@johnkamara
johnkamara / gist:dd22c9a457e06024303f611ea6f1e44c
Created March 10, 2021 22:06 — forked from 0ryant/gist:ba8a845221d8b69b6d20750d882732d9
Java - Coding Challenge 3 - Barking dog
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;
@johnkamara
johnkamara / gist:82aceb75ca6aa44cf2cee921f296770b
Created March 10, 2021 22:30 — forked from 0ryant/gist:e8d4d6323d96f960a4a3ad737991abb1
Java - Coding Challenge 6 - Equal Sum Checker
public class EqualSumChecker {
public static boolean hasEqualSum (int a, int b, int c) {
if (a+b==c){return true;}
return false;
}
}