Chapter 6 Programs
Chapter 6 Programs
class Employee
code = sc.nextInt();
sc.nextLine();
name = sc.nextLine();
basic = sc.nextDouble();
da = 0.15 * basic;
pf = 0.12 * basic;
gs = basic + da + hra;
ns = gs - pf;
class IncomeTax
String name ;
name = sc.nextLine();
msalary = sc.nextDouble();
} else {
itax = 0;
}
6::Define a class Security having the following description
Class name: Security
Data members/instance variables
String n : to store name of the security personnel
Int h: to store number of hours for which wages are to be paid
Double r: to store the hourly rate
Double w : to calculate the wages
Member methods:
• Void get() : to accept name .rate ,and number of hours worked
• Void calwage(): claculates the wages of security personnel
• Void display(): displays the details of security personnel
However security personnel are not allowed to work for more than
70 hours a week.
Write a program to compute the wage according to the gicen
condition and display the output as per given format
Number of hours Rate
Up to 40 hrs Rs. 1 r per hour
Up to next 20 hrs Rs 1.5 r per hour
For next 20 hrs Rs 2 r per hour