Java Reference
In-Depth Information
4 Interactive Checkbook Balancing Calculator (continued)
4. Type a constructor for the BufferedReader, as described in this chapter.
5. Declare both String and float variables for beginning balance, total deposits,
total checks, and total fees. Declare a float variable for ending balance. Use
user-friendly, unique names for each variable.
6. Using System.out.println() methods, enter lines of code to prompt the user
for each of the input variables, as shown in Figure 3-57. Include a readLine()
method to accept each input and assign it to its corresponding declared
String variable.
7. Enter code to convert each input variable to doubles or floats using the
appropriate parse() method.
8. Write a formula that takes the beginning balance plus the total deposits
minus the checks and fees, and assigns the value to the ending balance.
9. Write an output section that displays an appropriate message and the ending
balance on the display.
10. Label each section with an appropriate line comment.
11. Compile your program by pressing CTRL + 1 .
12. If there are no compilation errors, execute the program by pressing CTRL + 2 .
Enter the sample input data from Figure 3-57; confirm that the program
provides correct output data. Run the program again with your own per-
sonal data.
13. In the TextPad window, use the Print command on the File menu to print a
copy of the code for your instructor.
14. Quit TextPad.
5 Income to Debt Ratio Calculator
Many financial institutions make decisions about extending credit and financing
major purchases based on a customer's income to debt ratio. This ratio is the
percentage of a customer's income that is spent paying off debts such as mort-
gages, automobile loans, and other debt, such as credit cards. Typically, all debts
are added together and then that total is divided by the customer's monthly
income. Customers with a lower income to debt ratio are more likely to qualify
for a loan.
As an intern at the Employees' Credit Union, you have been asked to create
an interactive income to debt ratio calculation program that can run as a stand-
alone application. Input should be via dialog boxes. Table 3-20 on the next page
displays the inputs and outputs for the program.
Search WWH ::




Custom Search