Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StaffMember {
- public String name;
- public String address;
- public String phoneNum;
- public String socSecNum;
- public String payRate;
- String output= " ";
- public StaffMember(String name, String address, String phoneNum, String socsecNum, String payRate){
- this.name= name;
- this.address= address;
- this.phoneNum= phoneNum;
- this.socSecNum= socsecNum;
- this.payRate= payRate;
- }
- public String getName(){
- return name;
- }
- public String getAddress(){
- return address;
- }
- public String getPhoneNum(){
- return phoneNum;
- }
- public void pay(){
- System.out.println(getName()+" was paid $100.");
- }
- public String toString(){
- output += getName()+" "+getAddress()+" "+getPhoneNum();
- return output;
- }
- }
- public class Employee extends StaffMember{
- double payRate;
- public Employee(){
- super(name);
- super(address);
- super(phoneNum);
- }
- public double getPayRate(double payRate){
- return payRate;
- }
- public String toString(){
- super.toString()+" is paid at a rate of "+ getPayRate();
- }
- }
- public class Staff {
- StaffMember[] staffList= new StaffMember[10];
- public Staff(){
- // paid staff
- staffList[0]= new StaffMember("Curly Howard", "222 Stooge Street", "8675309", "947-88-2222", "100");
- staffList[1]= new StaffMember("Moe Howard", "222 Stooge Street", "8675309", "999-98-1418", "100");
- staffList[2]= new StaffMember("Larry Fine", "123 Fine Street", "2435555", "955- 85-9090", "100");
- staffList[3]= new StaffMember("Dan Marino", "1972 Dolphin Street", "9991972", "932-77-8684", "100");
- staffList[4]= new StaffMember("Don Shula", "1974 Dolphin Street", "9891973", "953-00-4499", "100");
- // volunteers
- staffList[5]= new StaffMember("Scuba Steve", "Scuba Avenue", "9782345", "413-66-9798", "0");
- staffList[6]= new StaffMember("Diver Dan", "Ocean Avenue", "9752298", "318-75-9999", "0");
- staffList[7]= new StaffMember("Zach", " 21 Jump Street", "9091487", "487-74-9788", "0");
- staffList[8]= new StaffMember("Jon", "Scotch Avenue", "9582745", "495-66-9088", "0");
- staffList[9]= new StaffMember("Jim Bob", "Shuffle Street", "9182005", "413-66-9798", "0");
- }
- public String toString(){
- String result= "";
- for(StaffMember n: staffList){
- result += n.toString();
- }
- return result;
- }
- public void payDay(){
- for(int n =0; n< 5; n++){
- staffList[n].pay();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement