Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

Explain equity finance and debt finance. (5 marks)

Answered: 1 week ago