Java Reference
In-Depth Information
quarters = Integer.parseInt(strQuarters) * 25;
dimes = Integer.parseInt(strDimes) * 10;
nickels = Integer.parseInt(strNickels) * 5;
pennies = Integer.parseInt(strPennies) * 1;
8. Compile the program by clicking Tools on the menu bar and then clicking
Compile Java. If the compilation results in any errors, correct the errors and
recompile the program.
9. Run the program by clicking Tools on the menu bar and then clicking Run
Java Application. Enter sample data to test the program. If the program runs
correctly, return to TextPad and print a copy of the source code for your
instructor. Otherwise, correct any errors and return to step 8.
10. Quit TextPad.
4 Interactive Checkbook Balancing Calculator
The local credit union has asked you to develop a simple program to help cus-
tomers balance their checkbooks. You decide to write a stand-alone Java applica-
tion that accepts the beginning balance, the total of the checks written, the total
of any deposits, and the fees charged by the bank as inputs. The program then
calculates and displays what the ending balance should be. Figure 3-57 displays
the results from executing the application. Perform the following steps:
FIGURE 3-57
1. Start TextPad. Save the new document as a Java source code file on the Data
Disk using the file name Balance.
2. Begin your code by typing a block comment with the Programming
Assignment number, your name, the current date, and the program name,
Balance.java. Write a description or purpose comment.
3. Type the import statement, class header, and main() method header and
their opening braces. Remember to use the phrase, throws IOException, as
the program will be interactive.
(continued)
Search WWH ::




Custom Search