if else

Report
Question

Please briefly explain why you feel this question should be reported .

Report
Cancel

Take an employee’s number of years of experience and their age and decide how much raise should be given to them in their salary. The condition is that if an employee’s experience is less than 3 years and his age is less than 40, he gets 20% raise, if their experience is less than 5 years and their age is less than 40, they get 30%, and if their experience is more than 7 years and their age is more than 40, they get 50% raise

in progress 0
Java 1 week 2 Answer 474 views 0

About mai

Answers ( 2 )

  1. ritwik

    Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    Please do not ask questions without code if you seek code in answer. Show us what you have written.

  2. Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    public class Exercise38 {

    public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int yearsOfExperience = 0;
    long salary = 45000;
    System.out.print(“Input yearsOfExperience: “);
    yearsOfExperience = scan.nextInt();
    int age = 0;
    System.out.print(“Input age: “);
    age = scan.nextInt();

    if(yearsOfExperience < 3 && age < 40)
    {
    salary = salary + ((salary * 20)/100) ;
    }
    System.out.print("Experience:"+yearsOfExperience + ",age:"+age + ",salary" + salary);
    }
    }

    I have solved only one condition , you can easily solve rest of the conditions

Leave an answer

Browse

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>