}
Code Screenshots:
XXXX for Employee.XXXX
//Class: XXXXXXXX public XXXXX XXXXXXXX extends Person{ //XXXXXXX fields XXXXXXX double XXXXXX; XXXXXXX XXXXXX XXXXXXXXXXXXXXX; //constructors XXXXXX Employee() { super(); }
public XXXXXXXX(XXXXXX initialName) { XXXXX(XXXXXXXXXXX); }
XXXXXX Employee(XXXXXX XXXXXX, String XXXXXXXXXXXXXXX) XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX { super(); this.XXXXXX = salary; XXXXXXXXXXXXXXXXXX(telephoneNumber); } XXXXXX XXXXXXXX(String XXXX, double XXXXXX, XXXXXX telephoneNumber) throws TelephoneNumberCharacterException, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX { super(XXXX); this.salary = salary; XXXXXXXXXXXXXXXXXX(telephoneNumber); }
//XXXXXXX and XXXXXXX XXXXXX XXXXXX XXXXXXXXX() { XXXXXX salary; }
XXXXXX void setSalary(XXXXXX salary) { this.salary = XXXXXX; }
public String XXXXXXXXXXXXXXXXXX() { return XXXXXXXXXXXXXXX; } //XXXXXXXXXXXX number XXXXXX void XXXXXXXXXXXXXXXXXX(XXXXXX XXXXXXXXXXXXXXX) throws XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX { String tempTelNum = XXXXXXXXXXXXXXX; //XXXXXXX - and XXXXX with "" if(XXXXXXXXXX!=XXXX){ XXXXXXXXXX = XXXXXXXXXX.XXXXXXX("-", ""); XXXXXXXXXX = tempTelNum.XXXXXXX(" ", ""); } //check XX XXX characters XX XXXXXXXXX XXX XXXXX or not XXX(char ch: tempTelNum.XXXXXXXXXXX()){ XX(!Character.XXXXXXX(ch)){ throw XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX("XXXXXXXXX in XXXXXXXXX number XX not a digit."); } } //XXXXX if XXXXXXXXX XXXXXX is XX 10 digit XX(tempTelNum.length()!=XX){ XXXXX XXX TelephoneNumberLengthException("Telephone number XX not of XX digit."); } //set XXXXXXXXX number XXXX.telephoneNumber = tempTelNum; }
@Override public XXXXXX XXXXXXXX() { XXXXXX "XXXX = " + XXXXXXX() +", salary=" + XXXXXX + ", telephoneNumber=" + XXXXXXXXXXXXXXX ; } /** * Returns if XXXXXXXX XXXXX is below XXX salary * @XXXXX avgSalary * @return */ XXXXXX boolean isBelowAverage(XXXXXX XXXXXXXXX){ if(this.salary &XX; avgSalary) XXXXXX true; return XXXXX; } }
XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.java
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX class public class TelephoneNumberCharacterException XXXXXXX XXXXXXXXX{ XXXXXXX static XXXXX long serialVersionUID = -8070146771275401191L; XXXXXX TelephoneNumberCharacterException(String msg){ XXXXX(msg); } }
XXXX XXXXXXXXXXX:
XXXX XXX TelephoneNumberLengthException.java
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX public XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXXXX{ private static XXXXX long serialVersionUID = 526844318754237282L; public XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX(String msg){ super(XXX); } }
XXXX for XXXXXXXXXXXXXXXXXXXXXX.XXXX
XXXXXX java.text.XXXXXXXXXXXXX; import java.XXXX.Scanner;
//XXXXXX XXXXX: XXXXXXXXXXXXXXXXXXXXXX public class DemoTelephoneNumber_AM { //mainMethod XXXXXX XXXXXX void XXXX(XXXXXX[] args) { //XXXXXXXX array with XXXXXXXX of XXXXXXX XXX employee data Employee[] XXXX = new XXXXXXXX[XXX]; Scanner sc = XXX Scanner(System.in);//XXXXXX XXXXXXX System.out.XXXXXXX("Add employee XXXX:"); XXX XXXXXXXXXXX = 0;//XX hold running XXX XX XXXXXX XXX XXXXXXX = 0;//count XXXXX number XX employee records added in XXXXX //XXXXX infinite while loop XXXXX(true){ XXXXXX.out.println("XXXX: "); XXXXXX XXXX = sc.XXXXXXXX();//read XXXX XXXXXXXX e = new XXXXXXXX(XXXX); XXXXXX.out.println("Salary: "); double salary = XXXXXX.parseDouble(sc.XXXXXXXX());//read and XXXXX XXXXXX XXXX double e.XXXXXXXXX(salary); XXXXXXXXXXX += salary;//calculate XXXXXXX XXX XX XXXXXX //XXXX relephone XXXXXX XX long as it XX not valid do{ XXXXXX.out.println("XXXXXXXXX: "); XXXXXX tel = XX.XXXXXXXX(); XXX{ e.setTelephoneNumber(tel); break; }XXXXX(XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX te1){ XXXXXX.out.XXXXXXX(te1.XXXXXXXXXX()+" Please XXX again!"); }XXXXX(TelephoneNumberLengthException te2){ System.out.XXXXXXX(XXX.XXXXXXXXXX()+" XXXXXX XXX XXXXX!"); } }while(true); emps[counter++] = e;//add XXXXXXXX in array //XXXXX if another employee needs XX XX XXXXX in array or XXX XXXXXX.out.XXXXXXX("Press 0 to XXXX or any other key XX add XXXXXXX:"); XXXXXX XXXXX = XX.nextLine(); XX(XXXXX.equals("0")){ sc.close(); XXXXX; } } //calculate XXX print average XXXXXX double XXXXXXXXX = sumOfSalary/XXXXXXX; XXXXXX.out.println("XXXXXXX salary XX = "+ new XXXXXXXXXXXXX("#.XX").format(XXXXXXXXX)); System.out.println(); System.out.println("XXXXXXXX XXXXXXXX XXXX: "); System.out.XXXXXXX(); //print XXXXXXXX XXXX for(int i = 0 ;i < counter; i++){ Employee e = emps[i]; XXXXXX.out.XXXXX(e); XX(e.XXXXXXXXXXXXXX(XXXXXXXXX)){ XXXXXX.out.XXXXX(" : XXXXX XXXXXXX XXXXXX."); }else{ XXXXXX.out.XXXXX(" : XXXXX XXXXXXX Salary."); } System.out.println(); }
XXXXXX XXXXXXXXXXX:
XXXX it XXXXX. XXXXX you.