Skip to content

Instantly share code, notes, and snippets.

/**
* 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 factoral{
public factoral(){
System.out.println(factorial(6));
}
public int factorial(int n){
int product = 1;
for(int i = 1; i <= n; i++){
product *= i;
}
return product;
import java.util.*;
public class ArrayListAssignment {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//int y = scan.nextInt();
ArrayList<Integer> ages = new ArrayList<Integer>();
boolean keepAsking = true;
System.out.println("Type in at least 6 ages of you and your family. After 6 ages, type in a negative number to continue.");
import java.util.*;
public class advisorySnacks {
public static void main(String[] args) {
// Creating an ArrayList of String
List<String> students = new ArrayList<>();
// Adding new elements to the ArrayList
students.add("Sameer");//
import java.util.*;
/**
* Write a description of class syllable here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class syllable
{
public static void main(String args[]){
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseListener;
import java.util.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseListener;
/**
* various math equations
*
* @author (Erica)
* @version (9/18/18)
*/
public class objectClass
{
public objectClass(){