Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners without scanner
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


dodo zayat
without scanner
3 Answer(s)      4 years and a month 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 .


Advertisement
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



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
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
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 - 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 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
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
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
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
input using scanner and add/sub/mul/div of a matrix
input using scanner and add/sub/mul/div of a matrix  hiiii...... performe matrix add/sub/mul/div using scanner
Action without a form.
Action without a form.  Can I have an Action without a form
Creating a File I/O using import scanner, io.* and text.*
Creating a File I/O using import scanner, io.* and text.*  open a file for reading and open another file for writing data. input file hours-int, hourly rate-double, name-string. output file name-string, hours-int, hourly rate
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
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
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
Sending email without authentication
Sending email without authentication  Hi sir, Am doing a project in JSP, in that i want to send mail without any authentication of password so send me code as soon as possible.   Please visit the following links
html table without border
html table without border  How to create a html table without border?   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN..." content="text/html; charset=utf-8" /> <title>Table without borders<
using tiles without struts
using tiles without struts  Hi I am trying to make an application using tiles 2.0. Description of my web.xml is as follows: tiles org.apache.tiles.web.startup.TilesServlet
how to reverse a string without changing its place
how to reverse a string without changing its place  how to reverse a string without changing its place   Hi Friend, Another way... void main(String[]args){ Scanner input=new Scanner(System.in
Advertisements
 

 

 

DMCA.com