Entry@ca0b6
Entry@10b30a7" for a hundred lines instead of what I put in.
import java.io.*;
import java.util.*;
class Entry {
public String name, number, note;
Entry()
{
name = "";
number = "";
note = "";
}
}
public class Phonebook {
public static Entry[] entrylist = new Entry[100];
public static void main(String[] args) throws Exception {
for (int i=0; i<entrylist.length; i++){
entrylist[i] = new Entry();
}
Scanner input = new Scanner(System.in);
File file = new File("contactlist.txt");
BufferedWriter output = new BufferedWriter(new FileWriter(file));
System.out.println("Codes are entered as 1 to 8 characters. \nUse \"e\" for enter, \"f\" for find, \"l\" to list, \"q\" to quit.");
int i = 0;
int j = 0;
while (i == 0) {
System.out.println("Command: ");
String g = input.next();
String[] token = g.split(" ");
String k = token[0];
if (k.equals("q")) {
break;
}
if (k.equals("e")) {
if (j >= entrylist.length){
System.out.println("You have already used all of your entries...");
}
else{
entrylist[j].name = input.next();
System.out.println("Enter number: ");
entrylist[j].number = input.next();
System.out.println("Note: ");
entrylist[j].note = input.next();
j++;
}
}
if (k.equals("f")) {
System.out.println("Ha, im not going to find shit!");
}
if (k.equals("l")) {
for (int l = 0; l < entrylist.length; l++){
if (entrylist == null){
System.out.println("");
}
else
System.out.println(entrylist[l]);
}
}
}
}
}

New Topic/Question
Reply



MultiQuote





|