import java.io.*;
interface access
{
public void input();
public void calc();
public void printop();
}
class student implements access
{
int tot, String stu= new String();String name= new String();
String grade =new String();
public void input()
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your total \n");
stu=br.readLine();
tot=Integer.parseInt(stu);
}
catch(Exception e)
{System.out.println("Student details are not given in correct format\n");}
}
public void calc()
{
if (tot>80) then
grade="A++");
else if (tot>70) then
grade ="A+";
else if (tot>60) then
grade = "A";
else
grade="NIL"
}
public void printop()
{
System.out.println("Name of the student is : \n"+name);
System.out.println("Total Mark is \t " + tot +"grade is \n"+ grade);
}
}
class empl implements access
{
int sal,tax, String emp= new String();String name= new String();
public void input()
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your total \n");
sal=br.readLine();
tot=Integer.parseInt(sal);
}
catch(Exception e)
{System.out.println("Enter your correct details\n");}
}
public void calc()
{
if (sal>500000) then
tax=10000;
else if (tot>400000) then
tax=9000;
else if (tot>300000) then
tax=8000;
else
tax=5000;
}
public void printop()
{System.out.println("Name of the Employee is : \n"+name);
System.out.println("Total Income is \t " + sal +"TAX is \n"+ tax);
}
}
public class interfacecon
{
public static void main(String[] args)
{
// Printing Student details
student stud1=new student();
stud1.input();
stud1.calc();
stud1.printop();
// printing Employee details
empl emp1=new empl();
emp1.input();
emp1.calc();
emp1.printop();
}
}
interface access
{
public void input();
public void calc();
public void printop();
}
class student implements access
{
int tot, String stu= new String();String name= new String();
String grade =new String();
public void input()
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your total \n");
stu=br.readLine();
tot=Integer.parseInt(stu);
}
catch(Exception e)
{System.out.println("Student details are not given in correct format\n");}
}
public void calc()
{
if (tot>80) then
grade="A++");
else if (tot>70) then
grade ="A+";
else if (tot>60) then
grade = "A";
else
grade="NIL"
}
public void printop()
{
System.out.println("Name of the student is : \n"+name);
System.out.println("Total Mark is \t " + tot +"grade is \n"+ grade);
}
}
class empl implements access
{
int sal,tax, String emp= new String();String name= new String();
public void input()
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your total \n");
sal=br.readLine();
tot=Integer.parseInt(sal);
}
catch(Exception e)
{System.out.println("Enter your correct details\n");}
}
public void calc()
{
if (sal>500000) then
tax=10000;
else if (tot>400000) then
tax=9000;
else if (tot>300000) then
tax=8000;
else
tax=5000;
}
public void printop()
{System.out.println("Name of the Employee is : \n"+name);
System.out.println("Total Income is \t " + sal +"TAX is \n"+ tax);
}
}
public class interfacecon
{
public static void main(String[] args)
{
// Printing Student details
student stud1=new student();
stud1.input();
stud1.calc();
stud1.printop();
// printing Employee details
empl emp1=new empl();
emp1.input();
emp1.calc();
emp1.printop();
}
}
No comments:
Post a Comment