Skip to content

Instantly share code, notes, and snippets.

import java.util.Scanner;
/**
* A simple class to run the Chatbot class.
* @author Laurie White
* @version April 2012
*/
public class DJKhaledDriver
{
/**
* A program to carry on conversations with a human user.
* This is the initial version that:
* <ul><li>
* Uses indexOf to find strings
* </li><li>
* Handles responding to simple words and phrases
* </li></ul>
* This version uses a nested if to handle default responses.
* @author Laurie White
public class JaydensDrive {
public static void main(String[] args) {
//STARTING PASSANGERS IN EACH BUS YOU CAN SWITCH TO
String[] passengersA = {"Jayden"};
String[] passengersB = {"Jayden", "Brother Noah", "Steven"};
String[] passengersC = {"Jayden", "Adrian", "Fang", "Yaphet"};
String[] passengersD = {"Jayden", "Dax", "Ashil"};
public class jaydensBus {
int seats; //how many seats in bus
int occupied; //how many seats taken
int gas; //gas in bus
int distance; //how far is destination
String destination; //where is destination
String busDriver; //driver's name
String[] passengers;//String for passengers in each bus, only records the starting amount of passengers
import java.util.Scanner;
public class GradeProgram_HW {
public static void main(String[] args) {//main
int choice;
Scanner sc = new Scanner(System.in);
int[] grades = new int [20];
for(int i=0;i<grades.length;i++) {
grades[i]=(int)(Math.random()*(100-60+1)+60);
}
import java.util.Scanner;
public class Scrambler_HW {
public static void main(String[] args) {//main
String pA = "Y";//sets play again
while(pA.equalsIgnoreCase("Y")){//play again
System.out.println("How would you like to shuffle the phrase?\n1) Default Scrambles (5)\n2) Specify a number of scrambles\n3) Run some trials");
Scanner sc = new Scanner(System.in);//scanner
import java.util.Scanner;
public class EAuser_HW {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("What is your government name? ");
String name = sc.nextLine();//saves name
System.out.print("What is your grad year? ");
String grad = sc.nextLine();//saves year
import java.util.Scanner;
public class PasswordGen_HW {
public static void main(String[] args) {
String s = "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()`~<>,.;’:[]{}/|_+-=?";
Scanner sc = new Scanner(System.in);
String pA = "Y";
//booleans for checking
boolean hasLet;
boolean hasNum;
import java.util.Scanner;
public class Is_a_Prime_HW {
public static void main(String[] args) {
int choice = 0;
while (choice != 4) {
System.out.println("\nWelcome to my Prime Number Program\n\t1) Prime Number Checker\n\t2)Print Primes 1-100\n\t3)Goldbach's Conjecture Calculator\n\t4) Quit");
System.out.print("\nChoose an option (1/2/3/4): ");
Scanner sc = new Scanner(System.in);
choice = sc.nextInt();
import java.util.Scanner;
public class _HW_Craps {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String pA = "Y";
int lose = 0;
int win = 0;