Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Criesval Campbell
- // javac eoyPacket.java && java eoyPacket
- // #11
- x = str.substring(0, string.length);
- if(x % 2) == 0 {
- System.out.println("false");
- } else {
- System.out.println("true");
- }
- // #12
- public static void hopscoth(int hops) {
- String space = " ";
- int number = 1;
- for(int i = 1; i <= hops; i++) {
- System.out.println(space);
- System.out.println(number);
- number++;
- System.out.println(number);
- number++;
- System.out.println(space);
- System.out.println(number);
- number++;
- }
- }
- // #13
- public class hasMidpoint {
- if(int a == int b && int b == int c) {
- return true;
- } elseif(((a + b) / 20) == ((b + c) / 20)) {
- return true;
- } else {
- return false;
- }
- }
- // #14
- public class before {
- public static void main(String[] args) {
- Date date = new Date(11, 5, 21);
- Date date2 = new Date(15, 11, 21);
- boolean before = date2.before(date);
- if(before == true) {
- System.out.println("Date 2 is before Date 1");
- } else {
- System.out.println("Date 2 is not before Date 1");
- }
- }
- }
- // #16
- public class coinToss {
- public static void main(String args[]) {
- Random generator = new Random();
- for(int i = 1; i >= 1; i++) {
- int coin = generator.nextInt(2);
- if(coin == 1) {
- int heads++;
- } else {
- int tails++;
- }
- if(heads == 3 || tails == 3) {
- if(heads == 3) {
- System.out.print("\nYou have gotten 3 heads!\n");
- } else if(tails == 3) {
- System.out.print("\nYou have gotten 3 tails!\n");
- }
- break;
- }
- }
- }
- }
- // #17
- public static boolean isVowel(String s) {
- if(s.equalsIgnoreCase("a") || s.equalsIgnoreCase("e") || s.equalsIgnoreCase("i") || s.equalsIgnoreCase("o") || s.equalsIgnoreCase("u")) {
- return true;
- } else {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement