GithubHelp home page GithubHelp logo

creating-a-table-to-store-employee-information's Introduction

CREATING-A-TABLE-TO-STORE-EMPLOYEE-INFORMATION

AIM:

To Write a Java Program To Store a Details.

Write a program that would print the information (name, year of joining, salary, address) of 
three employees by creating a class named 'Employee'. The output should be as follows:
Name           Year of joining                Address
 Robert              1994                  64C- WallsStreat
 Sam                 2000                  68D- WallsStreat
 John                1999                  26B- WallsStreat

ALGORITHM:

Step 1:

Define a class named "Employee" with instance variables to store employee details such as name,year of joining,address.

Step 2:

Create methods within the "Employee" class to get and set the values of these instance variables.

Step 3:

Instantiate an "Employee" object for each employee and set their details using the setter methods.

Step 4:

Create a collection (e.g., an ArrayList) to store the employee objects.

Step 5:

Prompt the user for input to gather the details of each employee.

Step 6:

Create a loop to repeat.After the loop ends, you can perform operations on the collection, such as searching for specific employees, displaying all employee details.

PROGRAM:

class Employee
{
   String Name;
   int Year;
   String Address;
   Employee(String nam,int years, String addr)
   {
       Name=nam;
       Year=years;
       Address=addr;}
   void Sam()
   {
       System.out.println(Name+ " " +Year + " " +Address); }
   void Robert()
   {
       System.out.println(Name+ " " +Year + " " +Address);}
   void John()
   {
       System.out.println(Name+ " "+Year + " " +Address);
   }}
class EmployeeDetails
{
   public static void main(String args[])
   {
       System.out.println("Name    " + "Year of Joining   " + "    Address" );
       Employee e=new Employee("Sam         ", 2000, "        68D-WallsStreet");
       e.Sam();
       Employee e1=new Employee("Robert      ", 1994, "        64C-WallsStreet");
       e1.Robert();
       Employee e2=new Employee("John        ", 2002, "        70F-WallsStreet");
       e2.Sam();
   }}

OUTPUT:

image

RESULT:

Thus The Output Is Verfied.

creating-a-table-to-store-employee-information's People

Contributors

harshavardhini33 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.