Donald Dalton

Greenhorn
+ Follow
since Apr 01, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Donald Dalton

This absolutely helps alot. Thanks. But before I dive in, I want to make sure I understand what you're telling me.

OK, here we go. I'll start with the Contact class
The purpose of Contact class is to hold variables?

//Define Contact class
public class Contact {
String firstName;
String lastName;
String eMail;
String phoneNum;

// constructor creates instance of contact class so it can be referenced
Contact contact = new Contact();
}

ContactsApp class allows for user input.
It's responsibilities:
-Accept user input
-If user wants to add contact, store contact info in array which is
declared and referenced with ContactDatabase class?

//Define ContactsApp
import java.io.*;

public class ContactsApp {
public static void main(String args[]) throws IOException
{
BufferedReader dataIn = new BufferedReader (new
InputStreamReader(System.in));

System.out.println("\tContact Database");
System.out.println();
System.out.print("Enter 1 to add new contact" + "\nEnter 2 to delete
contact" + "\nEnter 3 to list contacts" + "\nor Enter 0 to exit
program:");
String cmdLine = dataIn.readLine();

//Use control structure to allow user to enter each contact info
and save it in the ContactDatabase array? Not sure how. Nested if
statements?
if (cmdLine = 1)
System.out.println("First Name: ");
String cmdLine = dataIn.readLine();

}
}

I understand that when the user inputs contact info, the info should be saved in an array because there will be a possible 20 contacts, but how? I have problems understanding how arrays are "populated"? through user input.

//Define ContactDatabase- which creates and manages an array of contacts
public class ContactDatabase {

//Declare array
String[]contacts;

//construct array
String[]contact = new String[20];

ContactDatabase contactdatabase = new ContactDatabase ();
}

This is what I understand so far. If I am way lost let me know. I may just have to withdraw from this course and take it again. But, I believe I now better understand the steps involved. Again, I appreciate your help and let me know if I am indeed understanding what you explained. I also certainly appreciate you acting as a teacher because my goal is to learn java not to just get by in this class.
18 years ago
Hi all.

I am in urgent need of some help with an assignment.

Here are the requirements:
I am to write a console program that maintains a contact database. The
program should consist of at least two classes.

One class named Contact that will be used as an abstract data type for the
contact information. This class will contain fields for a person's first name
last name, email address, and phone number.

A second class named Project2 which will create an array of contacts. The program should present the user with the ability to:
Generate a numbered list of contacts
Add a new contact
Delete a contact by number
Exit

Each operation should be implemented as a seperate method in the Project2 class. No more than 20 contacts.

Any help will be greatly appreciated. I have been working on this assignment for 2 weeks and it is due in a couple days. I have created class Contact (not sure if this is right):


import java.io.*;

public class Contact
{
String firstName;
String lastName;
String eMail;
String phoneNum;
BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));

public Contact() throws IOException
{

System.out.print("Enter First Name: ");
firstName = dataIn.readLine();
System.out.print("Enter Last Name: ");
lastName = dataIn.readLine();
System.out.print("Enter eMail Address: ");
eMail = dataIn.readLine();
System.out.print("Enter Phone Number: ");
phoneNum = dataIn.readLine();
}

}

And here is what I have for the Project2 class:
import java.io.*;


public class Project2 {


public static void main(String args []) throws IOException
{

String a = "Add";

BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));

System.out.println("\tContact Database");
System.out.println();
System.out.print("Enter Add to add new contact" + "\nDelete to delete contact" +
"\nList to list contacts" + "\nor Exit to exit program:");
String cmdLine = dataIn.readLine();

} // end main method



} // end class Project

I'm probably way off but this is my first time taking a Java class. I haven't even written 50 lines of code, so I know I've got a long ways to go but don't even know if I've begun correctly or where to go next. Again, this is urgent. So a little nudge in the right direction would be great
18 years ago
Clever. Uhh...I guess I should pay more attention before posting. New to forum, I'll head over to General(beginners) & post my Q
*tucks tail between legs*
Hi all.

I am in urgent need of some help with an assignment.

Here are the requirements:
I am to write a console program that maintains a contact database. The
program should consist of at least two classes.

One class named Contact that will be used as an abstract data type for the
contact information. This class will contain fields for a person's first name
last name, email address, and phone number.

A second class named Project2 which will create an array of contacts. The program should present the user with the ability to:
Generate a numbered list of contacts
Add a new contact
Delete a contact by number
Exit

Each operation should be implemented as a seperate method in the Project2 class. No more than 20 contacts.

Any help will be greatly appreciated. I have been working on this assignment for 2 weeks and it is due in a couple days. I have created class Contact (not sure if this is right):


import java.io.*;

public class Contact
{
String firstName;
String lastName;
String eMail;
String phoneNum;
BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));

public Contact() throws IOException
{

System.out.print("Enter First Name: ");
firstName = dataIn.readLine();
System.out.print("Enter Last Name: ");
lastName = dataIn.readLine();
System.out.print("Enter eMail Address: ");
eMail = dataIn.readLine();
System.out.print("Enter Phone Number: ");
phoneNum = dataIn.readLine();
}

}

And here is what I have for the Project2 class:
import java.io.*;


public class Project2 {


public static void main(String args []) throws IOException
{

String a = "Add";

BufferedReader dataIn = new BufferedReader (new InputStreamReader(System.in));

System.out.println("\tContact Database");
System.out.println();
System.out.print("Enter Add to add new contact" + "\nDelete to delete contact" +
"\nList to list contacts" + "\nor Exit to exit program:");
String cmdLine = dataIn.readLine();

} // end main method



} // end class Project

I'm probably way off but this is my first time taking a Java class. I haven't even written 50 lines of code, so I know I've got a long ways to go but don't even know if I've begun correctly or where to go next. Again, this is urgent. Thank you very much for any help.