samedi 8 juillet 2017

i want that when the give input in employee_address is Banglore and salary is more than 25000,i get all the details of employee.

import java.util.Scanner;

public class ContactManager {

public static void main(String[] args) {
    // TODO Auto-generated method stub

    @SuppressWarnings("resource")
    Scanner s=new Scanner(System.in);


    int employee_id;
    String employee_name;
    String address;
    int mobile;
    int salary;
    String q;

    System.out.println("empolyee_id:");
    employee_id=s.nextInt();

    System.out.println("employee_name:");
    employee_name=s.next();

    System.out.println("mobile:");
    mobile=s.nextInt();

    System.out.println("address:");
    address=s.next();

    System.out.println("salary:");
    salary=s.nextInt();



    q="Banglore";




    if(address==q && salary>25000)
    {
        System.out.println(employee_name);
        System.out.println(employee_id);
        System.out.println(address);
        System.out.println(mobile);
        System.out.println(salary);
    }
    else
    {System.out.println("Sorry");}



}

}

"i have written this code but when i am giving input Banglore and 26000 it is not returning desired conditon." i want to get all employee details when the employee address is Banglore and salary is more than 25000.

Aucun commentaire:

Enregistrer un commentaire