have a program assigned to me for school and have no idea where to start. I don't know what it is about classes and objects but it loses me. This is what I have to make the program do:
Attributes:
String assetID
double cost
integer lifeExpectancy
String employee ID
String purchaseDate
String description
Methods:
Special construcor that sets assetID and employeeID, defualt values for the rest
Special constructor that takes and sets all data
Typical getters for all data
Special setters for assetID and employeeID that gurantees the two data are always stored in uppercase. These setters should be called from the special constructor.
Typcial setter for the rest
Create a method called calcAge that accepts the current date in a String, formatted as mm/dd/yyyy, and returns the age (in years only).
Predicate method to decide if the component needs to be replaced; name it outdated. Return true if the age exceeds the life expectancy, return false if the age is less than or equal to the life expectancy
Method called printData that prints all data including the age of the component to the console with labels.
This is what I have so far:
public class Asset
{
private String assetID;
private double cost;
private int lifeExpectancy;
private String employeeID;
private String purchaseDate;
private String description;
public Asset(String aid, String eid)
{
assetID = aid;
employeeID = eid;
}
public void setAssetID(String aid)
{
assetID=aid;
}
public void setCost(double cost)
{
cost=cost;
}
public void setLifeExpectancy(int lifeExpectancy)
{
lifeExpectancy=lifeExpectancy;
}
public void setEmployeeID(String eid)
{
employeeID=eid;
}
public void setPurachaseDate(String purchaseDate)
{
purchaseDate=purchaseDate;
}
public void setDescription(String description)
{
description=description;
}
public String assetID()
{
return assetID;
}
public double cost()
{
return cost;
}
public int lifeExpectancy()
{
return lifeExpectancy;
}
public String employeeID()
{
return employeeID;
}
public String purchaseDate()
{
return purchaseDate;
}
public String description()
{
return description;
}
}
Any help would be appreciated. I have no idea where to go with this since it is my first Java class taken and her assignments are a bit hard for what we have learned thus far.