
a company need a system to store the data about the employees , the number of employees is dynamic , you need to store the following attributes : name , age , salary and note that we need to solve it using array and class
and didn't use the scanner .

Hi Friend,
Whether the program will read the data through console or not?
Please clarify this!
Thanks

it works but i need it without scanner

Hi Friend,
Try the following code:
import java.io.*;
public class EmployeeData{
public static void main(String[] args) throws Exception{
String name[]=new String[2];
String age[]=new String[2];
String salary[]=new String[2];
String note[]=new String[2];
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
for(int i=0;i<2;i++){
System.out.println();
System.out.println("Employe "+(i+1));
System.out.print("Enter Name: ");
name[i]=br.readLine();
System.out.print("Enter Age: ");
age[i]=br.readLine();
System.out.print("Enter Salary: ");
salary[i]=br.readLine();
System.out.print("Enter Note: ");
note[i]=br.readLine();
}
FileWriter fw=new FileWriter(new File("employee.txt"),true);
BufferedWriter bw=new BufferedWriter(fw);
for(int i=0;i<2;i++){
bw.write(name[i]+" "+age[i]+" "+salary[i]+" "+note[i]);
bw.newLine();
}
bw.close();
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.