I am trying to get this class put together but I've always had trouble figuring out constructors. I don't know what to set the data fields in Customer(int customerID, int checkoutTime, int arrivalTime){}

// DO NOT ADD NEW METHODS OR DATA FIELDS!

class Customer
{
    private int customerID;
    private int checkoutTime;
    private int arrivalTime;

    Customer()
    {
    // add statements
    customerID = 0;
    checkoutTime = 0;
    arrivalTime = 0;
    }

    Customer(int customerID, int checkoutTime, int arrivalTime)
    {
    // add statements

    this.customerID = customerID;
    customerID = int cust;


    this.checkoutTime = checkoutTime;
    checkoutTime = int check;


    this.arrivalTime = arrivalTime;
    arrivalTime= int arriv;


    }

    int getCheckoutTime() 
    {
    // add statements


    return checkoutTime ;
    }

    int getArrivalTime() 
    {
    // add statements

    return arrivalTime;
    }

    int getCustomerID() 
    {

    return customerID; 
    }

    public String toString()
    {
        return ""+customerID+":"+checkoutTime+":"+arrivalTime;

    }

    public static void main(String[] args) {
        // quick check!
    Customer mycustomer = new Customer(20,30,40);
    System.out.println("Customer Info:"+mycustomer);

    }
}

I don't know what to set the data fields in Customer

Save the values passed in the constructor in the class's member variables.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.