I need help. I really can not figure out how to write this program. any help will be much appreciated. I need to get this done so I can graduate next week. Thank you!!!!!!!!!
Here is the program:
Write a program to enter Employee data, including social security number and salary, into an arry. (the maximum number of employees is 100, but your program should also work for any number of employees less than 100). your program should use two exception classes, one called ssnlengthexception for when the cocial security number enter is not exactly nine characters and the other called ssncharacterexception for when any character in the social security number is not a digit. when an exception is thrown, the user is reminded of what she or he enter, told why itis inappropriate and asked to reenter the data. after all has been entered your program will out put the records for all employees with an annotation stating whether the employee's salary is above or below average.
Here is the code I have so far: public class Employee extends Person
public static void main (String [] args) { try { system.out.println ("enter social security number:"); socialsecurityNumber = SavitchIn.readLine(); if (socialsecurityNumber!= ) throw new SSNLengthException ("socialsecurityNumber") } catch (SSNLengthException e) { system.out.println("you need 9 numbers" + e.getMessage ()); } }
public class SSNLengthException extends Exception { public SSNLengthException () { super ("Not enough characters!"); } public SSNLengthException (String message)) { super (message): } }
public class Person { private String name; private String socialSecurity; private String address; private String phone;
public Person () { name = "no name yet."; }
public Person (string initialName) { name = initialName; }
public void setName (string newName) { name = newName; }
public Sting getName () { return name; }
public void setSocialSecurity (String newSocialSecurity) { socialSecurity = initialSocialSecurity; }
public String socialSecurity () { return socialSecurity; }
public void setaddress (String newAddress) { address = newaddress; }
public String getaddress () { return address; }
public void setphone (String phone) { phone = newphone }