Write java program WAP to accept name of the worker,gender of worker(‘M’ for male, ‘F’ for female), no of hours worked and rate per hour using method call. Calculate the wages of worker as : hours*rate. Print All the details.
Answers
Answered by
0
Explanation:
Scanner sc = new Scanner(System.in); System.out.println("Enter Age"); int age = sc.nextInt(); System.out.println("Enter Sex M/F? "); char sex = sc.next().charAt(0); System.out.println("Are you married Y/N? "); char Married = sc.next().charAt(0); System.out.println("Age - " +age); System.out.println("Sex - " +sex); System.out.println("Married - " +Married); if (sex == 'F'){ System.out.println(" Employee will work only urban areas."); } else if (sex == 'M'&& age>=20 && age<40){ System.out.println("Employee may work anywher "); } else if (sex == 'M' && age>=40 && age <60){ System.out.println("Employee will work only urban areas"); } else if (age<20 || age>=60){ System.out.println(" ERROR "); }
- pranay7052
Similar questions