import java.text.DecimalFormat; /** * * @author (your name here) * @version (version number or date here) * */ public abstract class Employee { protected String name; protected int idNumber; protected Classifications validClassification; protected String jobTitle; protected DecimalFormat f; protected String type; public Employee() { initFormatting(); Classifications validClassifications = Classifications.SALARIED; name = "no names available"; } public void initFormatting() { f = new DecimalFormat(); f.applyPattern( "$#,##0.00;-$#,##0.00"); } public String setvalidClassification() { String type; switch(validClassification) { case SALARIED = validClassification.SALARIED; case HOURLY_FULL_TIME: case HOURLY_PART_TIME: default: type = "Unclasified"; } } public String getValidClassification() { String type; switch( validClassification ) { case SALARIED: type = "Salaried" ; break; case HOURLY_FULL_TIME: type = "Hourly Full Time" ; break; case HOURLY_PART_TIME: type = "Hourly Part Time" ; break; default: type = "Unclassified"; } return type; } public void computePay() { //left empty to allow static type checking to be successfull } public void print() { System.out.println("Employee Name: " + name); System.out.println("Employee ID: " + idNumber); if(type == "Salaried"){ System.out.println("Employee Classification is: " + getValidClassification()); } if(type == "Hourly Full Time"){ System.out.println("Employee Classification is: " + getValidClassification()); } if(type == "Hourly Part Time"){ System.out.println("Employee Classification is: " + getValidClassification()); } } // public void main ( String [] arg ) // { // Employee employ = new Employee(); // employ.setValidClassification(); // employ.getValidClassification(); // employ.computePay(); // employ.print(); // } }