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 ex53 { | |
public static void main(String[] args) { | |
printGrid(3, 6); | |
} | |
public static void printGrid(int rows, int cols) { | |
for (int line = 1; line <= rows; line++) { | |
for (int lineNum = line; lineNum <= (rows*cols) - rows; lineNum = lineNum + rows) { | |
System.out.print(lineNum); | |
System.out.print(", "); |
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
import java.util.Random; | |
import java.util.*; | |
public class inputRandomGame { | |
public static void main(String[] args) { | |
intro(); | |
gameMechanic(); | |
} | |
public static void looper(){ | |
System.out.println("Would you like to play again?(y/n)"); | |
Scanner ask = new Scanner(System.in); |
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
import java.util.Random; | |
import java.util.*; | |
public class inputRandomGame { | |
public static void main(String[] args) { | |
intro(); | |
gameMechanic(); | |
ask(); | |
} | |
public static void ask() { | |
System.out.println("Do you want to play again? (y/n)"); |
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
// Julia Haligowska | |
// 2022-01-13 | |
// CSE 142 AP CS A | |
// Birthday.java | |
// | |
// This program will calculate how many days are left until your next birthday (not including leap year), and will tell you a fun fact about my birthday at the end. | |
import java.util.*; // to use Scanner | |
public class Birthday { |
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
import java.util.*; // to use Scanner | |
public class Birthday { | |
public static void main(String args[]) { | |
Scanner console = new Scanner(System.in); //"spawning" in the scanner | |
intro(); | |
System.out.println("Please enter today's date:"); | |
System.out.println("What is the month (1-12)?"); |