Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Anyone could explain this java class step by step? thanks in advance! public class Customer { private static int latestUid = 1000; private String name;
Anyone could explain this java class step by step? thanks in advance!
public class Customer { | |
private static int latestUid = 1000; | |
private String name; | |
private long idNr; | |
private int uid; | |
/** | |
* Create a customer with a name and ID. The user is also given a unique | |
* customerNr (uid) | |
* | |
* @param name | |
* The name of the customer (e.g. Jane Smith) | |
* @param idNr | |
* The id of user (personnr) | |
*/ | |
public Customer(String name, long idNr) { | |
this.name = name; | |
this.idNr = idNr; | |
this.uid = ++latestUid; | |
} | |
/** | |
* @return The customer's name | |
*/ | |
public String getName() { | |
return name; | |
} | |
/** | |
* @return The customer's id (personnr) | |
*/ | |
public long getIdNr() { | |
return idNr; | |
} | |
/** | |
* @return The customer's unique number | |
*/ | |
public int getCustomerNr() { | |
return uid; | |
} | |
/** | |
* Returns a description of user (e.g. customerNr, name & idNr) | |
*/ | |
@Override | |
public String toString() { | |
return " (" + getName() + ", id " + getIdNr() + ", kundnr: " + getCustomerNr() + ")"; | |
} | |
} |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started