Professional Documents
Culture Documents
Assignment June 2014 Question 2
Assignment June 2014 Question 2
Question a
i) Normal constructor
Public carRental (int id, String ct, int hr)
{ userID=id ;
carType=ct ;
hour=hr ;
}
ii) Retriever
Public int getuserID()
{
return userID ;
}
Public String getcarType()
{
return carType ;
}
Public int gethour ()
{
return hour ;
}
iii) Processor method calcPayment
Public double calcPayment ()
{ double total = 0 ;
If (payment.equal (Kancil))
total = 3.00;
If (payment.equal (Myvi))
total = 4.00;
If (payment.equal (Saga))
total = 5.00;
If (payment.equal (Vios))
total = 7.00;
return total;
}