M
madanmohan
hey guys..m a beginner in java...m not able to print the data in the
following data...no errors,tis takin input successfully.
please help me to find the flaw...plzzzzzzzzz....!!!!!!!please edit
the code if required!!!!
HERE'S THE CODE:
import java.util.Scanner;
class mix
{
public static void main(String args[])
{
String name;
String education;
int age;
int contract;
int payment;
System.out.println("\nWELCOME TO MADANS FIRST JAVA PRACTICE
PROGRAM(hehe...)\n");
System.out.println("\nEnter canditate's name: ");
Scanner input = new Scanner(System.in);
name = input.nextLine();
System.out.println("\nEnter employers education: ");
education = input.nextLine();
System.out.println("\nEnter employers age: ");
age = input.nextInt();
System.out.println("\nEnter employers contract period: ");
contract = input.nextInt();
System.out.println("\nEnter employers salary/year: ");
payment = input.nextInt();
fresher emp = new fresher();
salary empsal = new salary();
emp.fresher(name,education,age);
empsal.salary(contract,payment);
printstatus display = new printstatus();
display.toprint();
System.out.println("\n\nTHANKING MYSELF FOR RUNNING THE PROGRAM
SUCCESSFULLY");
}
}
class printstatus
{
void toprint()
{
fresher details = new fresher();
details.showdata();
salary pay = new salary();
pay.paymentdetails();
}
}
class fresher
{
String name;
String education;
int age;
void fresher(String name,String education,int age)
{
name=name;
age=age;
education=education;
}
void showdata()
{
System.out.println("\n\n----------------EMPLOYEE
DETAILS--------------");
System.out.println("NAME : "+name);
System.out.println("QUALIFICATION : "+education);
System.out.println("AGE : "+age);
if(age>28)
{
System.out.println("APPLICATION STATUS : SORRY,YOUR APPLICATION HAS
NOT BEEN NOT ACCEPTED");
}
else
{
System.out.println("APPLICATION STATUS : ACCEPTED SUCCESSFULLY!!");
}
}
}
class salary extends fresher
{
int contract;
int payment;
int totalpayment;
void salary(int freshercontract,int fresherpayment)
{
contract=freshercontract;
payment=fresherpayment;
}
void paymentdetails()
{
if(age>28)
{
System.out.println("AMOUNT PAID IS :Rs.0000");
}
else
{
System.out.println("CONTRACT PERIOD : "+contract+"years");
System.out.println("SALARY : Rs."+payment);
System.out.println("GROSS AMOUNT TO BE PAID : Rs."+
(contract*payment));
System.out.println("IN-HAND PAYMENT RECEIVED :
Rs."+(0.4*contract*payment));
}
}
}
following data...no errors,tis takin input successfully.
please help me to find the flaw...plzzzzzzzzz....!!!!!!!please edit
the code if required!!!!
HERE'S THE CODE:
import java.util.Scanner;
class mix
{
public static void main(String args[])
{
String name;
String education;
int age;
int contract;
int payment;
System.out.println("\nWELCOME TO MADANS FIRST JAVA PRACTICE
PROGRAM(hehe...)\n");
System.out.println("\nEnter canditate's name: ");
Scanner input = new Scanner(System.in);
name = input.nextLine();
System.out.println("\nEnter employers education: ");
education = input.nextLine();
System.out.println("\nEnter employers age: ");
age = input.nextInt();
System.out.println("\nEnter employers contract period: ");
contract = input.nextInt();
System.out.println("\nEnter employers salary/year: ");
payment = input.nextInt();
fresher emp = new fresher();
salary empsal = new salary();
emp.fresher(name,education,age);
empsal.salary(contract,payment);
printstatus display = new printstatus();
display.toprint();
System.out.println("\n\nTHANKING MYSELF FOR RUNNING THE PROGRAM
SUCCESSFULLY");
}
}
class printstatus
{
void toprint()
{
fresher details = new fresher();
details.showdata();
salary pay = new salary();
pay.paymentdetails();
}
}
class fresher
{
String name;
String education;
int age;
void fresher(String name,String education,int age)
{
name=name;
age=age;
education=education;
}
void showdata()
{
System.out.println("\n\n----------------EMPLOYEE
DETAILS--------------");
System.out.println("NAME : "+name);
System.out.println("QUALIFICATION : "+education);
System.out.println("AGE : "+age);
if(age>28)
{
System.out.println("APPLICATION STATUS : SORRY,YOUR APPLICATION HAS
NOT BEEN NOT ACCEPTED");
}
else
{
System.out.println("APPLICATION STATUS : ACCEPTED SUCCESSFULLY!!");
}
}
}
class salary extends fresher
{
int contract;
int payment;
int totalpayment;
void salary(int freshercontract,int fresherpayment)
{
contract=freshercontract;
payment=fresherpayment;
}
void paymentdetails()
{
if(age>28)
{
System.out.println("AMOUNT PAID IS :Rs.0000");
}
else
{
System.out.println("CONTRACT PERIOD : "+contract+"years");
System.out.println("SALARY : Rs."+payment);
System.out.println("GROSS AMOUNT TO BE PAID : Rs."+
(contract*payment));
System.out.println("IN-HAND PAYMENT RECEIVED :
Rs."+(0.4*contract*payment));
}
}
}