how to make a program using this 4 steps in a an array as a menu,and can you please give an example or idea how to do this for steps:

1 accept of object
2 display of object
3 updating of object
4 deleting of object
thank you:

Recommended Answers

All 15 Replies

how to make a program

Many people use an IDE when they make a program, however you can use any text editor to do it.

If you are new to java, and have not covered GUI's yet, then one of the easier options of doing a menu is with a switch.

First thing is first, you need to create a class from which you can create an instance of the object, until you have that basic step done, there is no point trying to figure out the rest.

I just reread your post and realised it didn't quite make as much sense as when I skimmed it, Maybe try and word it better.

Member Avatar for coil

If you're doing a switch-case, then just use print prompts with System.out and then read in the input.

I think you need to repost your question and word it better please

Many people use an IDE when they make a program, however you can use any text editor to do it.

Ooh, ooh, can we have the IDE versus editor war? I dibs vi! :)

how to make a program using this 4 steps in a an array as a menu,and can you please give an example or idea how to do this for steps:

1 accept of object
2 display of object
3 updating of object
4 deleting of object
thank you:

Let's get a little more specific.

What sort of objects do you want to handle?
That will help us answer: how will you accept them? (as command-line input, interactive keyboard input, mouse-driven interface, some combination, or reading data from some source like a URL?)
What sort of representation do you want (list of data points in the standard output, pretty picture in a JFrame, plot a graph and render the graph into an audio file?)

Start with the first question: what sort of objects are we talking about?

/* This program would use console/GUI,*/
/* It should 
1 adding of object
2 display of object
3 updating of object
 4 deleting of object
 
*/

import java.util.*;

public class EmployeeList{

	private int [] Age;
	private String [] EmpfirstName;
	private String [] Emplast;
	private String [] Adrss;
	static Scanner console= new Scanner(System.in);
	
//	public EmloyeeList(){
	// what should i put this part
 //   }
	/* I want to enter the first name of the employee please check if the method is 
	  right*/
	public void EmpfirstName(String EmpfirstName){
	for(int i=0;i<EmpfirstName.length;i++)
	 System.out.println("Enter Employee first name");
	 EmpfirstName=console.nextLine();
	 System.out.println(EmpfirstName[i]);	
		}
	/*I want to enter the last name of the employee here same please if the is right*/
	 public void EmplastName(String  EmplastName){
	 	for(int i=0; i< EmplastName.length;++) 
		System.out.println("Enter Last Name");
		 EmplastName=console.nextLine();
		 System.out.println( EmplastName[i]);
		 }
		 	/*I want to enter the Address of the employee here same please if the is right*/

		 	public void Adrss(String  Adrss){
			for(int i=0;i< Adrss	.length;i++)
			System.out.println("Enter your Address");
			 Adrss=console.nextLine();
			 System.out.println( Adrss	[i]);
			 }	/*I want to enter the last name of the employee here same please if the is right*/

		public void Age(int age){
		 for(int=i;i<Age.length;i++)
		 System.out.println("Enter your Age");
		 Age=console.nextInt();
		 System.out.println(Age[i]);
		 }
		/* Please check if it is right because i was really confused
		thanks ...*/
		
		}
			
			}

Actually this is my code but i havent finish it yet,but what i want to do to this program is to enter the first name of employee,last name of the employee the address and the age of the employee then i want to display the objects that entered then I want to the menu in a switch and do this steps 1 adding of objects ,display of object ,deleting of object and updating object..but I still have a problem in code that i posted there still an error..i hope some one here can help in this program...thanks a lot....

in code that i posted there still an error.

Please copy and paste here the full text of the error messages

I really need a help to this to my program i hope someone can help me figured this out.Because i was confused to this program...can someone help me..
thanks.. i hope some one can edit my code into the correct one to solve the problem of my program.........

C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: ';' expected
         for(int=i;i<Age.length;i++)
                ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: not a statement
         for(int=i;i<Age.length;i++)
                    ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: ')' expected
         for(int=i;i<Age.length;i++)
                               ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: ';' expected
         for(int=i;i<Age.length;i++)
                                   ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:58: class, interface, or enum expected
            }
            ^
7 errors

 ----jGRASP wedge2: exit code for process is 1.
 ----jGRASP: operation complete.

 ----jGRASP exec: javac -g C:\Documents and Settings\Home\Desktop\PhoneDirec.java
 ----   at: Sep 17, 2010 8:47:08 PM

 ----jGRASP wedge: pid for wedge is 3960.
 ----jGRASP wedge2: pid for wedge2 is 212.
 ----jGRASP wedge2: CLASSPATH is ".;;.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Program Files\jgrasp\extensions\classes".
 ----jGRASP wedge2: working directory is [C:\Documents and Settings\Home\Desktop] platform id is 2.
 ----jGRASP wedge2: actual command sent ["C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -g "C:\Documents and Settings\Home\Desktop\PhoneDirec.java"].
 ----jGRASP wedge2: pid for process is 2276.


 ----jGRASP wedge2: exit code for process is 0.
 ----jGRASP: operation complete.

 ----jGRASP exec: javac -g C:\Documents and Settings\Home\Desktop\PhoneDirec.java
 ----   at: Sep 17, 2010 8:47:18 PM

 ----jGRASP wedge: pid for wedge is 840.
 ----jGRASP wedge2: pid for wedge2 is 3764.
 ----jGRASP wedge2: CLASSPATH is ".;;.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Program Files\jgrasp\extensions\classes".
 ----jGRASP wedge2: working directory is [C:\Documents and Settings\Home\Desktop] platform id is 2.
 ----jGRASP wedge2: actual command sent ["C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -g "C:\Documents and Settings\Home\Desktop\PhoneDirec.java"].
 ----jGRASP wedge2: pid for process is 2152.


 ----jGRASP wedge2: exit code for process is 0.
 ----jGRASP: operation complete.

 ----jGRASP exec: javac -g C:\Documents and Settings\Home\Desktop\EmployeeList.java
 ----   at: Sep 17, 2010 9:07:29 PM

 ----jGRASP wedge: pid for wedge is 1172.
 ----jGRASP wedge2: pid for wedge2 is 812.
 ----jGRASP wedge2: CLASSPATH is ".;;.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Program Files\jgrasp\extensions\classes".
 ----jGRASP wedge2: working directory is [C:\Documents and Settings\Home\Desktop] platform id is 2.
 ----jGRASP wedge2: actual command sent ["C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -g "C:\Documents and Settings\Home\Desktop\EmployeeList.java"].
 ----jGRASP wedge2: pid for process is 1620.

C:\Documents and Settings\Home\Desktop\EmployeeList.java:20: invalid method declaration; return type required
  public EmloyeeList(){
         ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:33: illegal start of expression
        for(int i=0; i< EmplastName.length;++) 
                                             ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: not a statement
         for(int=i;i<Age.length;i++)
             ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: ';' expected
         for(int=i;i<Age.length;i++)
                ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: not a statement
         for(int=i;i<Age.length;i++)
                    ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: ')' expected
         for(int=i;i<Age.length;i++)
                               ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:48: ';' expected
         for(int=i;i<Age.length;i++)
                                   ^
C:\Documents and Settings\Home\Desktop\EmployeeList.java:58: class, interface, or enum expected
            }
            ^
8 errors

this the error of my code and please if you already get the correct one please the post it ...
thanks a lot

private int [] Age;
public void Age(int age){
for(int=i;i<Age.length;i++)

you have several variables/method named Age. You have confused the compiler. It does't know which one you want. Change them all so that they are different.

C:\Documents and Settings\Home\Desktop\EmployeeList.java:58: class, interface, or enum expected

Check that all the {} are paired correctly.

yeah that what...but please just edit my program please...so that it well be really ok
thank NormR1 thanks you so much i hope you well my favor i ask you

Which thread are you going to use now?

yeah that what...but please just edit my program

There are probably some chuckleheads who will be willing to do your homework for you - there's been a lot of that lately. Don't worry, some maroon will come along who wants to show off how half-smart he is, and post some possibly-working code that you can just take and turn in, without bothering to think about or learn from the assignment.

Or, if you're actually interested, you could conceivably try to use the advice you've just been given and fix the problem. Your call.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.