i'm a beginner in coding and i try to write a parking lot program.
There are 3 classes in my program.
Could anyone help me out ,I got stuck in the record class which is datetime in and out and how to set overtime price.
****sorry about my bad english.
CAR
- type:int
- typename: String
- price1:double // parking price
- price2:double // overtime cost 10$ for over time!
RECORD
- car_data:CAR
- datetime1:datetime //in
- datetime2:datetime // out
+ TotalPrice() // datetime 1,2 and car_data
MAIN
- ArrayList<RECORD> recordList
here is my code
}
public void setOverTime(int overTime) {
this.overTime = overTime;
}
public int getType() {
return type;
}
public void setType(int type) {
price=40;
this.type = type;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
if(getType()==1){
price=20;
}
if(getType()==2){
price=40;
}
this.price = price;
}
and
package ParkingLot;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class Record {
private String getDateTime() {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
return dateFormat.format(date);
}
public void total(){
}
}