import java.util.*;
class employee
{
public static void main (String args[])
{
employeeinfo ob = new employeeinfo();
ob.get();
ob.totalsalary();
ob.display();
}
}
class employeeinfo
{
Scanner in = new Scanner (System.in);
Scanner ins = new Scanner (System.in);
String name,gender,position;
int id,salary,ma,hr,bn;
void get()
{
System.out.print ("\n\t Enter employee ID = ");
id = in.nextInt();
System.out.print ("\n\t Enter emplyee name = ");
name = ins.nextLine();
System.out.print ("\n\t Enter employee gender = ");
gender = ins.nextLine();
System.out.print ("\n\t Enter employee salary = ");
salary = in.nextInt();
System.out.print ("\n\t Enter employee position = ");
position = ins.nextLine();
}
void totalsalary()
{
System.out.print ("\n\t Enter medical allowance = ");
ma = in.nextInt();
System.out.print ("\n\t Enter house rent = ");
hr = in.nextInt();
System.out.print ("\n\t Enter bounus = ");
bn = in.nextInt();
}
void display()
{
System.out.println ("\n\t Employee ID = "+id);
System.out.println ("\n\t Employee name = "+name);
System.out.println ("\n\t Employee gender = "+gender);
System.out.println ("\n\t Employee basic salary = "+salary);
System.out.println ("\n\t Employee position/post = "+position);
System.out.println ("\n\t Total salary = "+(ma+hr+bn+salary));
}
}
Once you find the right websites then you
ReplyDeleteadd a link to these websites on your links page and send an individual email
to each one of these website owners. This item is not as
comprehensive as their paid versions, but it may well
provide ongoing assistance if you have a limited budget.
With a little training you can learn to spot these phonies and pick
up on the best internet marketing strategies around.
Also visit my web site review of market samurai
Create a class Employee with the following private member variables.
ReplyDeleteint employeeId
String employeeName
double salary
double netSalary
Include appropriate getters and setters method in Employee class. Write the following method in the Employee class:
public void calculateNetSalary(int pfpercentage) - This method should take PF percentage as argument. Deduct the PF amount from the salary and set the netSalary.
Create a Main class which has the main method which invokes the method to get the input and prints the details as shown in the sample.
Also write a method :
public static Employee getEmployeeDetails() - which gets the employee details and returns the employee object.
public static int getPFPercentage() - which gets the PF percentage and returns the same
Sample Input 1:
Enter Id:
101
Enter Name:
Vivek
Enter salary:
20000
Enter PF percentage:
7
Sample Output 1:
Id : 101
Name : Vivek
Salary : 20000.0
Net Salary : 18600.0
can I know the code for this please
DeleteHeya! can you please help me in this...
DeleteGuys help me in my project to create a prothat computes a salary from employees and deduct absence
ReplyDeletepublic static Employee getEmployeeDetails() - which gets the employee details and returns the employee object.
ReplyDeleteCreate a class Employee with the following private member variables.
ReplyDeleteint employeeId
String employeeName
double salary
double netSalary
Include appropriate getters and setters method in Employee class. Write the following method in the Employee class:
public void calculateNetSalary(int pfpercentage) - This method should take PF percentage as argument. Deduct the PF amount from the salary and set the netSalary.
Create a Main class which has the main method which invokes the method to get the input and prints the details as shown in the sample.
Also write a method :
public static Employee getEmployeeDetails() - which gets the employee details and returns the employee object.
public static int getPFPercentage() - which gets the PF percentage and returns the same
Did you get the code?
DeleteI need hepl..
//Class Employee:
Deletepublic class Employee
{
private int employeeId;
private String employeeName;
private double salary;
private double netSalary;
static int pfpercentage;
public int getEmployeeId()
{
return employeeId;
}
public void setEmployeeId(int employeeId)
{
this.employeeId=employeeId;
}
public String getEmployeeName()
{
return employeeName;
}
public void setEmployeeName(String employeeName)
{
this.employeeName=employeeName;
}
public double getSalary()
{
return salary;
}
public void setSalary(double salary)
{
this.salary=salary;
}
public double getNetSalary()
{
return netSalary;
}
public void setNetSalary(double netSalary)
{
this.netSalary=netSalary;
}
public void calculateNetSalary(int pfpercentage)
{
this.pfpercentage=pfpercentage;
double deduct=(salary*pfpercentage)/100;
netSalary=salary-deduct;
}
public void display()
{
System.out.println("Id : " +employeeId);
System.out.println("Name : " +employeeName);
System.out.println("Salary : " +salary);
System.out.println("NetSalary :" +netSalary);
}
}
//Class Main:
import java.util.Scanner;
public class Main
{
static int pfpercentage;
public static Employee getEmployeeDetails()
{
Employee em=new Employee();
System.out.println("Enter Id:");
em.setEmployeeId(101);
System.out.println("Enter Name:");
em.setEmployeeName("Vivek");
System.out.println("Enter salary:");
em.setSalary(20000);
System.out.println("Enter PF percentage");
em.calculateNetSalary(getPFPercentage());
em.display();
return em;
}
public static int getPFPercentage()
{
Scanner sc=new Scanner(System.in);
pfpercentage=sc.nextInt();
return pfpercentage;
}
public static void main(String[] args)
{
getEmployeeDetails();
}
}
Thnak you
DeleteCreate a class Person with the following private member variables
ReplyDeleteString name
char gender
int age
Include appropriate getters and setters method
Create a class BusTicket with the following private member variables
int ticketNo
float ticketPrice
float totalAmount
Person person
Include appropriate getters and setters method
Write the following method in the BusTicket class
void calculateTotal()—this method should calculate the total and set it based on the discount given below:
For Children whose age is less than 16, give 50% discount
For Senior citizen whose age is greater than or equal to 60 give 25% discount
For Ladies give 10% discount
No discount for remaining category.
Based on above condition calculate total price.
Create TestMain class which has main method and do the following input and output process .
To get the input write a method
public static BusTicket getTicketDetails() - Get the inputs relevant to BusTicket in this method and return the BusTicket object. Call this method in the main method, using the returned object invoke the method calculateTotal and print the output accordingly
Sample input 1:
Enter the passenger name:
vivek
Enter the gender(M or F / m or f):
M
Enter the age:
16
Enter the ticket no:
123
Enter the ticket price:
100.0
Sample Output 1
Ticket no:123
Passenger Name:vivek
Price of a ticket : 100.0
Total Amount : 100.0
Sample input 2:
Enter the passenger name:
Priya
Enter the gender(M or F / m or f):
F
Enter the age:
61
Enter the ticket no:
140
Enter the ticket price:
500.0
Sample Output 1
Ticket no:143
Passenger Name:Priya
Price of a ticket : 500.0
Total Amount : 375.0
Did you got this code?
ReplyDeleteI need help.
please help me with the code for the question
DeleteThis comment has been removed by the author.
ReplyDelete/* Write a class name employee. This class should hold the employee's
ReplyDeletedetails such as employee id,name,gender,salary. Write a member
function to input all these details and displaying the information
on the screen. Supply another member function to calculate the net
salary for an employee */
import java.util.*;
class employeeinfo{
Scanner sc=new Scanner(System.in);
int id,ma,hr,bn;
float salary;
String name;
void get(){
System.out.print("\n\t id:- ");
id=sc.nextInt();
System.out.print("\n\t name:- ");
name=sc.next();
System.out.print("\n\t salary:- ");
salary=sc.nextFloat();
}
void totalsalary(){
System.out.print ("\n\t Enter medical allowance = ");
ma = sc.nextInt();
System.out.print ("\n\t Enter house rent = ");
hr = sc.nextInt();
System.out.print ("\n\t Enter bounus = ");
bn = sc.nextInt();
}
void display(){
System.out.println ("\n\t Employee ID = "+id);
System.out.println ("\n\t Employee name = "+name);
System.out.println ("\n\t Employee basic salary = "+salary);
System.out.println ("\n\t Total salary = "+(ma+hr+bn+salary));
}
}
class employee{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
employeeinfo ei=new employeeinfo();
int number,i;
System.out.println("Enter the Howmany employee:-"); //Howmany employee U get
number = sc.nextInt();
for(i=1;i<=number;i++){
System.out.println("------------Input-Data------------");
ei.get();
ei.totalsalary();
System.out.println("------------OutPut-Data-----------");
ei.display();
}
}
}
how to use column and raw span in formation of table
ReplyDeleteCreate a class Person with the following private member variables
ReplyDeleteString name
char gender
int age
Include appropriate getters and setters method
Create a class BusTicket with the following private member variables
int ticketNo
float ticketPrice
float totalAmount
Person person
Include appropriate getters and setters method
Write the following method in the BusTicket class
void calculateTotal()—this method should calculate the total and set it based on the discount given below:
For Children whose age is less than 16, give 50% discount
For Senior citizen whose age is greater than or equal to 60 give 25% discount
For Ladies give 10% discount
No discount for remaining category.
Based on above condition calculate total price.
Create TestMain class which has main method and do the following input and output process .
To get the input write a method
public static BusTicket getTicketDetails() - Get the inputs relevant to BusTicket in this method and return the BusTicket object. Call this method in the main method, using the returned object invoke the method calculateTotal and print the output accordingly
Note: Define all the attributes as private and methods as public.
Sample input 1:
Enter the passenger name:
vivek
Enter the gender(M or F / m or f):
M
Enter the age:
16
Enter the ticket no:
123
Enter the ticket price:
100.0
Sample Output 1
Ticket no:123
Passenger Name:vivek
Price of a ticket : 100.0
Total Amount : 100.0
Sample input 2:
Enter the passenger name:
Priya
Enter the gender(M or F / m or f):
F
Enter the age:
61
Enter the ticket no:
140
Enter the ticket price:
500.0
Sample Output 1
Ticket no:143
Passenger Name:Priya
Price of a ticket : 500.0
Total Amount : 375.0
need a code for this problem
Q)
ReplyDeleteWrite a class employee that contain following attributes.
-name of employee
- phone number
- designation
- job type ( parmenant or daily wages)
Class also contain following method
- intilize the following attributes
-by using method overloading .1st display function display all data related to parmenant employee( name,phone number,designation,monthly salary,bonus, yearly salary,extra working hour)
- 2nd display function display all data related to daily wages employee(name,ph#,designation,total working hour,total wages)
Create a child class of employee class "parmenant employee class" and "daily wages employee"
Child classes contains following attribute
Parmenant employee / daily wages employee
- monthly salary / monthly wages
- extra working hour / total working hour
- annual salary
- bonus( paramenant, daily wages employee)
Member function
- that calculate salary / calculate daily wages monthly income.
(Note : object passing in display function.
Enter data for 5 parmenant employee and 5 daily wages employee)