Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class readSalary {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String name;
- int salary, meritPoints;
- String[] grade = {"A","B","C"};
- int terminator = 0;
- while (terminator == 0) {
- System.out.println("Enter Name n");
- name = sc.nextLine();
- System.out.println("Enter Salary n");
- salary = sc.nextInt();
- System.out.println("Enter Merit Points n");
- meritPoints = sc.nextInt();
- if (salary > 600 && salary < 649) {
- if (meritPoints < 10) {
- System.out.println("Employee: "+name+" has a grade of: "+grade[2]);
- }
- else {
- System.out.println("Employee: "+name+" has a grade of: "+grade[1]);
- }
- }
- else if (salary > 700 && salary < 900) {
- if (meritPoints < 20) {
- System.out.println("Employee: "+name+" has a grade of: "+grade[1]);
- }
- else {
- System.out.println("Employee: "+name+" has a grade of: "+grade[0]);
- }
- }
- System.out.println("Type 1 to Quit, or 0 to Continue n");
- terminator = sc.nextInt();
- if (terminator == 0) {
- terminator = 0;
- }
- else {
- terminator = 1;
- }
- }
- sc.close();
- }
- }
Add Comment
Please, Sign In to add comment