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
package solver; | |
//import kivaworld.FloorMap; | |
import javax.swing.*; | |
import javax.swing.filechooser.FileNameExtensionFilter; | |
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.util.LinkedList; |
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
/** | |
* Pool Puzzle | |
* Your job is to take code snippets from the pool and place them into the blank lines in the code. | |
* You may not use the same snippet more than once, and you won't need all the snippets. | |
* Your goal is to make a class that will compile and run to produce the output listed. | |
* Don't be fooled--this one's harder than it looks. | |
* | |
* Output | |
* %>java PoolPuzzleOne | |
* a noise |
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 MyThisTest { | |
private int a; | |
public MyThisTest() { | |
this(42); // calls the other constructor | |
} | |
public MyThisTest(int a) { | |
this.a = a; // assigns the value of the parameter a to the field of the same name |
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 SimpleCalculator { | |
private double firstNumber; | |
private double secondNumber; | |
public double getFirstNumber(){ | |
return firstNumber; | |
} | |
public double getSecondNumber(){ | |
return secondNumber; |
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
//Udemy | |
//Java Programming Masterclass covering Java 11 & Java 17 | |
//Number Palindrome | |
// | |
//Write a method called isPalindrome with one int parameter called number. | |
//The method needs to return a boolean value. | |
//It should return true if the number is a palindrome number otherwise it should return false. | |
//Check the tips below for more info about palindromes. | |
// | |
//Example Input/Output |
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
//Udemy | |
//Java Programming Masterclass covering Java 11 & Java 17 | |
//Sum Odd and While and Do While Loop Statement Challenges | |
// | |
//////////////////////////////SUM ODD////////////////////////////// | |
// | |
//Write a method called isOdd with an int parameter and call it number. | |
//The method needs to return a boolean value. | |
//Check that number is > 0, if it is not return false. | |
//If number is odd return true, otherwise 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
//Udemy | |
//Java Programming Masterclass covering Java 11 & Java 17 | |
//For Loop Challenge IsPrime | |
// | |
// Create a for statement using any range of numbers. | |
// Determine if the number is a prime number using the isPrime method. | |
// If it is a prime number, print it out AND increment a count of the number of prime numbers found. | |
// if that count is 3 exit the for loop. | |
// hint: Use the break; statement to exit |
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
//Udemy | |
//Java Programming Masterclass covering Java 11 & Java 17 | |
//Number Of Days In Month | |
// | |
//Write a method isLeapYear with a parameter of type int named year. | |
//The parameter needs to be greater than or equal to 1 and less than or equal to 9999. | |
//If the parameter is not in that range return false. | |
//Otherwise, if it is in the valid range, calculate if the year is a leap year and return true if it is, otherwise return false. | |
// | |
//A year is a leap year if it is divisible by 4 but not by 100, or it is divisible by 400. |
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
//Udemy | |
// Java Programming Masterclass covering Java 11 & Java 17 | |
// Number In Word | |
// | |
// Write a method called printNumberInWord. | |
// The method has one parameter number which is the whole number. | |
// The method needs to print "ZERO", "ONE", "TWO", ... "NINE", "OTHER" | |
// if the int parameter number is 0, 1, 2, .... 9 or other for any other number including negative numbers. | |
// You can use if-else statement or switch statement whatever is easier for you. | |
// |
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
//Udemy | |
//Java Programming Masterclass covering Java 11 & Java 17 | |
//Day of the Week Challenge | |
// | |
//Write a method with the name printDayOfTheWeek that has one parameter of type int and name it day. | |
// | |
//The method should not return any value (hint: void) | |
// | |
//Using a switch statement print "Sunday", "Monday", ... ,"Saturday" if the int parameter "day" is 0, 1, ... , 6 respectively, | |
//otherwise it should print "Invalid day". |