/** * Author: Josiah Yoder et al. * Class: SE1011-051 * Lesson: Week 10, Day 1 */ import java.util.ArrayList; import java.util.Scanner; public class Example051_10_1 { /* * This is a scratch-paper method */ public static void main(String[] ignored) { // Arrays // Complex051_10_1[] array; // array = new Complex051_10_1[5]; // Complex051_10_1 c = array[0]; // array[0] = c; // // // int l = array.length; // ArrayLists // ArrayList list; // list = new ArrayList(); // Complex051_10_1 c2 = list.get(0); // list.set(0,c); // Complex051_10_1 c3 = list.remove(0); // list.add(c); // int l2 = list.size(); // Write a program // to ask the user for complex numbers // // Stuff them in an ArrayList // (add) // // When they enter 0 0 stop // asking for numbers. // // Don't hurt people! System.out.println("The team is: "+((int)(Math.random()%7) + 1)); // Thank you Team 1, self-named "Team Awesome" Scanner in = new Scanner(System.in); ArrayList list; list = new ArrayList(); boolean end = false; double real = 0; double imaginary = 0; while(!end){ System.out.print("Input real number: "); real = in.nextDouble(); System.out.print("Input imaginary number: "); imaginary = in.nextDouble(); if(real==0 && imaginary == 0) end = true; else list.add(new Complex051_10_1(real, imaginary)); } } }