Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) Write a class DialogBox containing the following Input methods (i) inputNZDAmount() which displays a dialog box Input the NZD Amount asking user to Input

image text in transcribed

(a) Write a class DialogBox containing the following Input methods (i) inputNZDAmount() which displays a dialog box Input the NZD Amount asking user to "Input the NZD Amount: "and finally returns the input as a real number OK Cancel Before the returning the input, ask the user to confirm using a dialog box, which contains "The Select an Option input is: , is it correct?", where "user input" is the input of the user. If the user does not The input is: 20, is it correct? confirm "yes", return zero. Copy the class, including import statement(s), as the answers to this part No Cancel (ii) checkNZDAmount () which calls inputNZDAmount) to get the NZD amount to check and nothing is returned. The NZD amount should be greater than zero. If not so, display the error message "The NZD amount should be greater than zero" and then call inputNZDAmount ) to get the NZD amount again until it is correct. You need to use a loop to achieve this. Copy the method as the answers to this part Message I The NZD amount should be greater than zero (iii) main(): which creates a DialogBox object and calls the method check NZDAmount () for testing. Copy the method as the answers to this part [10] (b) Write a class Conversion containing the following methods constructor : which builds the frame shown on the right side. The frame consists of a text field for inputting a NZD amount, a label with 10 spaces for an equivalent HKD amount, and a button to start the calculation. Declare any necessary attributes in the class and add appropriate action listeners for future use. Copy the class, including import statement(s), as the answers to this part. (i) Calculate (ii) actionPerformed () which performs the calculation and puts the result on the label when the button is pressed. You can assume one NZD is equivalent to 5.5 HKD. You can assume a valid real number l-112 is entered in the textfield. Copy the method as the answers to this part 67.87 Calculate (ii) main) : which creates a Conversion object and sets it visible for testing. Copy the method as the answers to this part [20]

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

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions