Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package program5;
- import java.io.Serializable;
- import java.text.DecimalFormat;
- // Write the Psuedocode
- public class Employee {
- // instance variables
- private Name employeeName;
- private double pay;
- // default constructor
- public Employee () {
- }// end default constructor
- // constructor
- public Employee (String last, String first, String middle, String title) {
- employeeName = new Name (title, last, first, middle);
- }// end Employee
- public Name getEmployeeName () {
- return employeeName;
- }// end getEmployeeName
- public String Earnings(double pay) {
- return employeeName + ": " + pay;
- }// end Earnings
- }// end class
- package program5;
- import java.io.Serializable;
- public class Name extends Employee {
- // instance variables
- private String firstName;
- private String lastName;
- private String middleName;
- private String title;
- public Name(String last, String first, String middle, String title)
- {
- firstName = first;
- lastName = last;
- middleName = middle;
- this.title = title;
- }// end constructor
- public String getFirstName()
- {
- return firstName;
- }// end getFirstName
- public String getLastName()
- {
- return lastName;
- }// end getLastName
- public String gettitle()
- {
- return title;
- }// end getTitle
- public void setFirstName(String first)
- {
- firstName = first;
- }// end SetFirstName
- public void setLastName(String last)
- {
- lastName = last;
- }// end setLastName
- public void setTitle(String title)
- {
- this.title = title;
- }// end setTitle
- public String toString()
- {
- return title + " " + lastName + ", " + firstName;
- }// end toString
- }// end class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement