/* 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 ...*/
		
		}
			
			}

And well you please edit my code if theres something i forgot to add and if theres wrong can you please edit..thanks...

Recommended Answers

All 10 Replies

You are creating a separate array for each variable, You could do that much easier by creating another class called Employee with age,firstname,lastname,address as the arguments. e.g.

Public class Employee(age,empFirst,empLast,empAddr)
{

}

This way, you would only need to make 1 Array, but this array would be an array of the employee object, meaning in can hold all that information you want to keep in 1 place

Now, your

Public EmployeeList()

is a constructor. It prepares the new object for use, often accepting parameters which the constructor uses to set any member variables required when the object is first created. There are 2 types of constructors, default constructors and parameterized constructor. I suggest you read up on constructors before you continue.

Is this effective could you try to apply that in my code...because i try it but it does not work maybe I did not get what your trying to say...please try to edit then i well see what wrong i did..I had really no idea how to do it what your trying to say to me.. please help me to my program.....please..please...please...please...
thank you thank you....

Is this effective could you try to apply that in my code...because i try it but it does not work maybe I did not get what your trying to say...please try to edit then i well see what wrong i did..I had really no idea how to do it what your trying to say to me.. please help me to my program.....please..please...please...please...
thank you thank you....

Sorry but I don't have the time to do it. In my opinion the code you have is very messy. Here is some advice:
1. Keep your class file for the information about that class only! Don't try and code the whole project in one class, as it gets very confusing and messy.
2. The main things you should have in a class are: Constructors, instance variables, getter/setter a.k.a accessor/mutator methods, toString method. All other code should be done in the main class.
3.Read up on the proper way to create classes, nobody here will do this work for you.

churva_churva
What are you trying to do here?
Learn java programming or have your homework done for you?

No i want to learn from experts.but im just askin your idea because i was really confused and i was really stuck in here....im still trying to solve my problem here

Look closely at the difference between line 48 (wrong) and line 41 (better). The problem's near the beginning of the line.

theres still an error could you help me fix my error

And if you dont mind well you edit ...my code because there was really somthing wrong ti my code but i dont get it..
thanks JamesCherrill..thanks

Thread closed, please refer to the second instance that was left open here

@churva_churva I recommend you start following forum rules or you will soon face closed doors of this forum.

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.