Google+ Followers

Connect

Get Updates Via Email

Enter your email address:

Delivered by FeedBurner

Sunday, 10 November 2013

Java Program: User defined input using BufferedReader, Checking Employee Age

import java.io.*;
public class EmployeeAgeCheck {
    public static void main(String[] args) throws IOException
    {
        EmployeeData e=new EmployeeData();
        e.getdetails();
        e.checkage();      
    }
}
class EmployeeData
{
    private String name;
    private int age;

    public void getdetails() throws java.io.IOException
    {
        // user defined input at runtime
        BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter name");
        name=buf.readLine();
        System.out.println("Enter Age");
        age=Integer.parseInt(buf.readLine());
    }
    public void checkage()
    {
        if(age<=30)
        {
            System.out.println(name+ " ,You're Junior Employee");
        }
        else
        {
            System.out.println(name+ " ,You're Senior Employee");
        }
    }
}

1 comment :

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete

Share this to your friends