From 6b1b5bc70a7ba8b9d9bb4022772faf120597c512 Mon Sep 17 00:00:00 2001 From: Gustavo Tavares Dias Date: Thu, 8 May 2014 15:19:09 +0800 Subject: [PATCH] Create PerDayRental.java Change by Gustavo Dias, James McNeil, Ryan Law --- PerDayRental.java | 125 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 PerDayRental.java diff --git a/PerDayRental.java b/PerDayRental.java new file mode 100644 index 0000000..594087b --- /dev/null +++ b/PerDayRental.java @@ -0,0 +1,125 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author 041401076 + */ +public class PerDayRental { + + + /* + * Variables + * + * CostPerDay - Cost in Dollars per day to rent + * KmTraveled - Total Kilometers traveled by car + * TotalDays - Total days the car has been rented for + */ + + private double costPerDay; + private double kmTraveled; + private int totalDays; + + /* + * Default Constructor + */ + + public PerDayRental() + { + costPerDay = 100; //Default Value given in description + kmTraveled = 0; + totalDays = 0; + } + + /* + * Construtor specifying data + */ + public PerDayRental(double costPerDay, double kmTraveld, int totalDays) + { + this.costPerDay = costPerDay; + this.kmTraveled = kmTraveld; + this.totalDays = totalDays; + } + + /* + * Get Methods + */ + + public double getCostPerDay() + { + return costPerDay; + } + + public double getKmTraveled() + { + return kmTraveled; + } + + public int getTotalDays() + { + return totalDays; + } + + /* + * Set Methods + */ + public void setCostPerDay(double costPerDay) + { + this.costPerDay = costPerDay; + } + + public void setKmTraveled(double kmTraveled) + { + this.kmTraveled = kmTraveled; + } + + public void setTotalDays(int totalDays) + { + this.totalDays = totalDays; + } + + /* + * Calaculate the total cost + */ + + public double getTotalCost() + { + return (totalDays * costPerDay); + } + + public String getCostSts() + { + String str = "" + (totalDays * costPerDay); + return str; + } + + /* + * Add Days + * + * Default Adds one day + * Overloaded specifies input + */ + + public void addDay() + { + totalDays += 1; + } + + public void addDay(double daysAdded) + { + totalDays += daysAdded; + } + + /* + * Add Kilomets + * Adds specified amount of kilomters + */ + + public void addKm(double kmAdded) + { + kmTraveled += kmAdded; + } +} +