Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package project4checkoutsim;
- /**
- *
- * @author Sven
- */
- public class Customer {
- private int customerNumber;
- private int itemNeeded;
- private double avgPickTime;
- private double arriveTime;
- //private boolean getServed;
- public Customer(int custNumber, double arrivalTime, int itemsNeeded, double avgPickupTime){
- customerNumber = custNumber;
- arriveTime = arrivalTime;
- itemNeeded = itemsNeeded;
- avgPickTime = avgPickupTime;
- // getServed = false;
- }
- public int getCustNum(){
- return customerNumber;
- }
- public double getArrivalTime(){
- return arriveTime;
- }
- public double calcShopTime(){
- double shoptime;
- shoptime = avgPickTime * itemNeeded;
- return shoptime;
- }
- public double calcFinishTime(){
- double finishtime;
- finishtime = this.calcShopTime() + arriveTime;
- return finishtime;
- }
- //basically takes time from getServed = True minus finishtime
- public double calcWaitTime(){
- double waittime;
- waittime = CheckoutLane.calcCheckoutTime()-this.calcFinishTime();
- return waittime;
- }
- public double calcEndCheckout(){
- double endcheck;
- endcheck = this.calcFinishTime() + CheckoutLane.calcCheckoutTime();
- return endcheck;
- }
- ///returns the shortest lane (based on available express or no)
- public int findShortestLane(){
- int lowestlanelength = 100;
- int lowestlanenumber = 0;
- if(this.itemNeeded <= 12){
- for(CheckoutLane.getLaneType()=="express"){
- if(CheckoutLane.getCurLength()<lowestlanelength){
- lowestlanelength = CheckoutLane.getCurLength();
- lowestlanenumber = CheckoutLane.getLaneNumber();
- }
- }
- }
- else{
- for(CheckoutLane.getLaneType()=="regular"){
- if(CheckoutLane.getCurLength()<lowestlanelength){
- lowestlanelength = CheckoutLane.getCurLength();
- lowestlanenumber = CheckoutLane.getLaneNumber();
- }
- }
- }
- return lowestlanenumber;
- }
- public void enterLane(){
- CheckoutLane.addCust(this);
- }
- public int getNumItems(){
- return this.itemNeeded;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement