first program

import java.io.*;
abstract class staff
{
 int no;
 String name;
 void lint_data(int n, String na)
 {
  no=n;
  name=na;
 }
 abstract void calculate_salary();
}

class typist extends staff
{
   int speed,salary=0;
   void calculate_salary(int n,String na,int s)
   {
super(n,na);
speed=s;
    if(speed<40)
     salary=4000;
    else
     salary=5000;
   }
   void display()
   {
System.out.println("Name: "+name);
System.out.println("NO: "+no);
System.out.println("Speed is: "+speed);
System.out.println("Salary is: "+salary);
   }
 }

 class capable
 {
 public static void main(String args[])throws IOException
 {
 typist t=new typist();
 t.calculate_salary(1,"Atul",32);
 t.display();
 }
 }

Comments

Popular posts from this blog

Third program

Second Program