Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

without scanner

Ads

 
 

Share on Google+Share on Google+

dodo zayat
without scanner
3 Answer(s)      6 years and 7 months ago
Posted in : Java Beginners

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 .

Ads
View Answers

December 7, 2010 at 3:41 PM


Hi Friend,

Whether the program will read the data through console or not?

Please clarify this!

Thanks



December 8, 2010 at 2:05 AM


it works but i need it without scanner



December 8, 2010 at 4:20 PM


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


Ads









Related Tutorials/Questions & Answers:
without scanner
without scanner  a company need a system to store the data about the employees , the number of employees is dynamic , you need to store the following... and class and didn't use the scanner .   Hi Friend, Whether
XII STD RECURSION WITHOUT SCANNER
XII STD RECURSION WITHOUT SCANNER  the recursive function gives a stack overflow error. I want to calculate the GDC ie the greatest Integer function... not wish to use the scanner class Is there anything i can do to improve
Advertisements
Scanner
Scanner   Hi, I am facing a problem in the following code as what should be the while condition I should use in order to get the loop keep running...= "Celsius"; do { Scanner temp_ip= new Scanner(System.in
can we use scanner class,class , object and methods to get output without using constructor ????
can we use scanner class,class , object and methods to get output without using constructor ????  im getting error here..i hav used scanner class... am i getting error here... can we get output using scanner class , object
without ;
without ;  can u give me an example of a program without
without ;
without ;  can u give me an example of a program without
Scanner class
Scanner class  what have to do when an error occur about Scanner class.i code scanner sc=new Scanner(System.in); but it shows an error regarding this.   Use Scanner sc=new Scanner(System.in
Scanner class
Scanner class  import java.util.*; class Dd { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int... Scanner class was introduced in java 5
scanner program
scanner program  a news paper boy purchase 100 papers every day.he purchases papers at Rs.1.50 and sells at Rs.2.00 at each.any unsold news papers... his profit..using scanner
scanner - Java Beginners
scanner   how to ask user to enter index in arry using scanner
scanner problem - Java Beginners
scanner problem  the program that enters sides of the triangle using scanner and outputs the area of triangle  Hi Friend, We... main(String []args){ Scanner scanner = new Scanner(System.in
Hp scanner - Java Beginners
Hp scanner  Hi guys, i would like to access hp scanner using java programme. could you refer me some useful information to proceed
Scanner vs. BufferedReader
Scanner vs. BufferedReader  I have to decide from these two classes to read a file. File is of .txt type and its size is around 4.5 GB. There other text files also which is around 7 to 10 GB. So, which class is to be used to read
cannot find symbol Scanner sc = new Scanner(system.in)
cannot find symbol Scanner sc = new Scanner(system.in)  In my one of the program in getting the error: cannot find symbol Scanner sc = new Scanner(system.in) How to resolve the error: cannot find symbol Scanner sc = new Scanner
scanner Class Error - Java Beginners
scanner Class Error  Hello Sir ,When i run the program of Scanner Class ,there is Error Can not Resolve Symbol-Scanner how i can solve..., Scanner class is not provided. Check your version.It should work with java 1.5
Version of com.metapossum>metapossum-scanner dependency
List of Version of com.metapossum>metapossum-scanner dependency
Iteration without loop
Iteration without loop  Hi, Is there any way I can have a line of code iterate a number of times set by the user without having a while loop or any...[] args) { Scanner input=new Scanner(System.in
Java file scanner
Java file scanner In this section, you will learn how to read a file using Scanner class. Description of code: J2SE5.0 provides some additional classes.... It also parses the primitive data. Scanner class gives a great deal of power
barcode scanner device usage in database application
barcode scanner device usage in database application  Am trying to design a supermarket inventory desktop database application however I can't seem to know how to use a barcode scanner device on my application can anyone put me
Version of com.agapsys>jpa-scanner-maven-plugin dependency
List of Version of com.agapsys>jpa-scanner-maven-plugin dependency
Version of com.agapsys>rcf-scanner-maven-plugin dependency
List of Version of com.agapsys>rcf-scanner-maven-plugin dependency
Version of com.agapsys>scanner-maven-plugin-lib dependency
List of Version of com.agapsys>scanner-maven-plugin-lib dependency
Action without a form.
Action without a form.  Can I have an Action without a form
Pattern,Matcher,Formatter and Scanner classes
Pattern,Matcher,Formatter and Scanner classes This section Describes : 1... using the Formatter and Scanner classes and the PrintWriter.format/printf..., n) Formatted input The scanner API provides basic input
with out using scanner mul two matrices
with out using scanner mul two matrices  write a java program to multiply two matrices and print there result. note: don't use the scanner and the values is passed at run time....   import java.io.*; class
Application without Interface Builder!!
Application without Interface Builder!!  Can we make our iphone application without Interface Builder???   hello, yes , it is possible to make an iphone application without interface builder.. we can also use only
Breaking a string into words without using StringTokenizer
Breaking a string into words without using StringTokenizer  how can we Break a string into words without using StringTokenizer ??   ... { public static void main(String[] args) { Scanner input=new
Double To Int Without TypeCasting
Double To Int Without TypeCasting  How to convert Double to Int without using typecasting?   class ConvertDoubleToInt { public static void main(String[] args) { double d=25.5; int num=new
DataGrid without DataBase
DataGrid without DataBase  I want display list of data without using database. Ex- Employee have some elements like- name, sex, place, designation. I have to display the content of these elements but without having
without using built-in functions
without using built-in functions  Hai sir... Please help me to solve this... Findout occurances of each string in every another string (built - in functions are not at all allowed) all, and, sand, falling wall and sand