*Account Class with an Instance Variable of Type double*
// Fig. 3.13: Account.java
// Account class with a constructor to validate and
// initialize instance variable balance of type double.


*AccountTest Class to Use Class Account*
// Fig. 3.14: AccountTest.java
// Inputting and outputting floating-point numbers with Account objects.


Output :


*Displaying Text in a Dialog Box*
The programs presented thus far display output in the command window. Many applications
use windows or dialog boxes (also called dialogs) to display output. Web browsers
such as Firefox, Internet Explorer, Chrome and Safari display web pages in their own windows.
E-mail programs allow you to type and read messages in a window. Typically, dialog
boxes are windows in which programs display importantmessages to users. Class JOption-
Pane provides prebuilt dialog boxes that enable programs to display windows containing
messages—such windows are called message dialogs

// Fig. 3.17: Dialog1.java

Output :


Output :


// Using JOptionPane to display multiple lines in a dialog box.


Ouput :








Komentar

Postingan populer dari blog ini

Rangkuman Buku "Sistem Analysis and Design

Life as a Software and Engineer

KALKULATOR SEDERHANA