Question: Write a class name PinNumber. A PinNumber should be useful for storing a four digit pin number, perhaps as part of some ATM machine software.

Write a class name PinNumber. A PinNumber should be useful for storing a four digit pin number, perhaps as part of some ATM machine software.

Your PinNumber class should have one constructor that accepts four integer arguments. The four digits of the pin. You do not need to error check. You can assume that the values passed in are integers between 0 and 9.

 public PinNumber(int first, int second, int third, int fourth) 

Write a setter for each of the four digits:

public int getFirst() public int getSecond() public int getThird() public int getFourth() 

Write an equals method that accepts a PinNumber as an argument and returns true if receiving PinNumber has the same four values as the parameter.

public boolean equals(PinNumber o) 

Write a toString() method that returns a String that shows all four values. The exact format is up to you.

public String toString() 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!