R. L. Hendrix
CSC 119 -01
February 16, 2011
Program #2
Algorithm used to solve:
I used Inheritance to do this program as well as get and set methods and override.
Data used to test:
public class Employee
{
protected String name;
protected String ID;
protected int age;
protected double salary;
protected String title;
protected String deptname;
public Employee( String myname, String myID, int myage, double mysalary,
String mytitle, String mydeptname )
{
name = myname;
ID = myID;
age = myage;
salary = mysalary;
title = mytitle;
deptname = mydeptname;
}
public void setName( String myname )
{
name = myname;
}
public String getName()
{
return name;
}
public void setID( String myID )
{
ID = myID;
}
public String getID()
{
return ID;
}
public void setMyage( int myage )
{
This
preview
has intentionally blurred sections.
Sign up to view the full version.
age = myage;
}
public int getAge()
{
return age;
}
public void setTitle( String mytitle )
{
title = mytitle;
}
public String getTitle()
{
return title;
}
public void setDeptname( String mydeptname )
{
deptname = mydeptname;
}
public String getDeptname()
{
return deptname;
}
public void setSalary( int mysalary, double bonus )
{
salary = salary + (salary * 0.05 );
}

This is the end of the preview.
Sign up
to
access the rest of the document.
- Fall '10
- Jackson
- Marketing, Inheritance, Separation of Powers, Return statement, Void type, Jimmy Hart
-
Click to edit the document details