This file contains hidden or 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.ArrayList; | |
import java.util.Scanner; | |
public class SeatReservation { | |
/*** Methods for ArrayList of Seat objects ***/ | |
public static void makeSeatsEmpty(ArrayList<Seat> seats) { | |
int i = 0; | |
for (i = 0; i < seats.size(); ++i) { | |
seats.get(i).makeEmpty(); |
This file contains hidden or 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 Sample2 { | |
public static void main(String[] args) { | |
String[] suits = {"Clubs", "Diamonds","Hearts", "Spades"}; | |
String[] ranks = {"Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"}; | |
System.out.println("The message\n----------"); | |
for (int i = 0; i < suits.length; i++) { |
This file contains hidden or 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.Scanner; | |
public class Sample { | |
public static void main(String[] args) { | |
String name; | |
String gender; | |
String criminalRecord; | |
String timelyCreditPayment; |
This file contains hidden or 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 org.apache.commons.codec.binary.StringUtils; | |
public class E2C { | |
public static void main(String args[]) { | |
String input = "DA-AC-C+DDAFB+"; | |
int am=0; | |
int a = 0; |
This file contains hidden or 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.Arrays; | |
import java.util.Random; | |
public class Test5 { | |
public static void main(String[] args) { | |
int[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9}; | |
Random r = new Random(); |
This file contains hidden or 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.Scanner; | |
public class ArraysKeyValue { | |
public static void main (String [] args) { | |
final int NUM_ROWS = 2; | |
final int NUM_COLS = 2; | |
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS]; | |
int i = 0; | |
int j = 0; | |
int maxMiles = 0; // Assign with first element in milesTracker before loop |
This file contains hidden or 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.Scanner; | |
public class PrintWithComma { | |
public static void main (String [] args) { | |
final int NUM_VALS = 4; | |
int[] hourlyTemp = new int[NUM_VALS]; | |
int i; | |
hourlyTemp[0] = 90; | |
hourlyTemp[1] = 92; |
This file contains hidden or 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.Scanner; | |
public class SumOfExcess { | |
public static void main (String [] args) { | |
final int NUM_VALS = 4; | |
int[] testGrades = new int[NUM_VALS]; | |
int i = 0; | |
int sumExtra = -9999; // Assign sumExtra with 0 before your for loop | |
testGrades[0] = 101; |
This file contains hidden or 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.Scanner; | |
public class FindMatchValue { | |
public static void main (String [] args) { | |
final int NUM_VALS = 4; | |
int[] userValues = new int[NUM_VALS]; | |
int i = 0; | |
int matchValue = 0; | |
int numMatches = -99; // Assign numMatches with 0 before your for loop |
This file contains hidden or 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 StudentScores { | |
public static void main (String [] args) { | |
final int SCORES_SIZE = 4; | |
int[] oldScores = new int[SCORES_SIZE]; | |
int[] newScores = new int[SCORES_SIZE]; | |
int i = 0; | |
oldScores[0] = 10; | |
oldScores[1] = 20; | |
oldScores[2] = 30; |