Program to create a class 'Manager' to calculate the salary. Import the above package 'useFul' and make use of salary( ) method

In this program we use the package useFul to import the class UseMe in another class Manager. Here we have used the salary( ) method of UseMe class to calculate the gross salary of manager.
PROGRAM
import useFul.UseMe;

class Manager
{
 public static void main(String b[])
 {
  UseMe u2 = new UseMe();
  u2.salary(15000,2500,1500);
 }
}
OUTPUT
C:\>javac Manager.java
C:\>java Manager
Basic salary = 15000.0
DA = 2500.0
HRA = 1500.0
Gross Salary = 19000.0

Popular posts from this blog

Program to define a class 'employee' with data members as empid, name and salary. Accept data for 5 objects using Array of objects and print it.

Define a class Student with four data members such as name, roll no.,sub1, and sub2. Define appropriate methods to initialize and display the values of data members. Also calculate total marks and percentage scored by student.

Program to input age from user and throw user-defined exception if entered age is negative