Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.at2;
- import java.util.Scanner;
- public class Employee {
- private String name;
- private int empNo;
- private double salary;
- private String EmployerName;
- private int zipCode;
- private String title;
- public int age;
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- determineTitle();
- // name, empNo = constant
- // rest can change
- Employee john = new Employee("john", 12345);
- }
- public void setAge(int age){
- this.age = age;
- }
- public int getAge(){ return age;}
- public int getEmpNo(){ return empNo;}
- public void printAge(int age){
- System.out.println(age);
- }
- public double getSalary() {
- return salary;
- }
- public void setSalary(double salary) {
- this.salary = salary;
- }
- public int getZipCode() {
- return zipCode;
- }
- public void setZipCode(int zipCode) {
- this.zipCode = zipCode;
- }
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public void printEmpNo(int empNo){
- System.out.println(empNo);
- }
- //read in
- public static void determineTitle(){
- Scanner sc = new Scanner(System.in);
- System.out.println("Please input years of experience: ");
- int i = sc.nextInt();
- if(i == 0){
- System.out.println("Trainee");
- } else if((i == 1) || (i == 2)){
- System.out.println("Manager");
- } else {
- System.out.println("Senior Manager");
- }
- }
- public Employee(){
- }
- public Employee(String name, int empNo){
- this.name = name;
- this.empNo = empNo;
- }
- }
- /*
- Input: 1
- Output: Manager
- Input: 0
- Output: Trainee
- Input: 5
- Output: Senior Manager
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement