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
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