0% found this document useful (0 votes)
11 views1 page

Lab P3

Uploaded by

nimranazia18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Lab P3

Uploaded by

nimranazia18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

Scanner;
public class Employee {
private int ID;
private String name;
private double salary;
public Employee(int id,String name,double salary)
{
this.ID=id;
this.name=name;
this.salary=salary;

}
public void raiseSalary(int percent)
{
salary=salary+percent*salary/100;
//return salary;
}
void Display()
{
System.out.println("Employee id"+ID);
System.out.println("Employee name"+name);
System.out.println("Employee salary"+salary);
}
}
class EmpDemo
{
public static void main(String[] args)
{

Scanner sc=new Scanner(System.in);


System.out.println("enter employee ID NAME & SALARY details");
int id=sc.nextInt();
// System.out.println("enter name");
String name=sc.nextLine();
//System.out.println("enter salary");
double salary=sc.nextDouble();
Employee e=new Employee(id,name,salary);
System.out.println("employee details before increment");
e.Display();
e.raiseSalary(10);
System.out.println("employee details after increment");
e.Display();

}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy