Question: java ** It is a peer lab exercise . You should work with the other classmate to complete the exercise. Both of you can submit
java
** It is a peer lab exercise. You should work with the other classmate to complete the exercise. Both of you can submit the same work. Please include both programmers' names and IDs in the source files.
Revise from Assignment 0 you just completed to display the loan payment in a console output. Lets modify it using JOptionPanedialogs to get the users inputs, confirm the information, and print out the loan amount.
You will use the following dialog boxes:
- JOptionPane.showInputDialog ask the loan amount($), and loan duration (years)
- JOptionPane.showConfirmDialog display the loan amount and loan duration to get the users confirmation. (If the users confirmation is no, the dialog will ask for users input again.)
- JOptionPane.showMessageDialog display the loan payment with annual interest rate from 5%~8% every 1/8%.
- Make sure to change the title of each dialog box to Lab Exercise 1 instead of the default title.
- After get the users inputs, make sure to convert the Strings into numbers.
-
double amount = Double.parseDouble(string1);
-
int year = Integer.parseDouble(string2);
-
- Use String.format() to format the output before display in the message dialog.
- Include both programmers' names and student IDs in the first line of each source file.
- Submit your source code (LabExercise1.java) and screenshots of test run in Canvas by the deadline
Sample output:


Rubric
Lab Exercise1 Lab Exercise 1 Enter the loan amount: (S) Please enter the loan period (years) ) 1000 Cancel OK Cancel OK Lab Exercise 1 The loan amount is 1000.00, and the loan duration is 2 year(s). Continue! No Yes Lab Exercise 1 Monthly Payment($) Total Payment($) Interest Rate(%) 5.000 5.125 5.250 5.375 5.500 5.625 5.750 5.875 6.000 6.125 6.250 6.375 6.500 6.625 6.750 6.875 7.000 7.125 7.250 7.375 7.500 7.625 7.750 7.875 8.000 43.87 43.93 43.98 44.04 44.10 44.15 44.21 44.26 44.32 44.38 44.43 44.49 44.55 44.60 44.66 44.72 44.77 44.83 44.89 44.94 45.00 45.06 45.11 45.17 45.23 1052.91 1054.26 1055.60 1056.9!5 1058.30 1059.64 1060.99 1062.34 1063.69 1065.05 1066.40 1067.75 1069.11 1070.47 1071.82 1073.18 1074.54 1075.90 1077.26 1078.63 1079.99 1081.3!5 1082.72 1084.09 1085.45 Lab Exercise1 Lab Exercise 1 Enter the loan amount: (S) Please enter the loan period (years) ) 1000 Cancel OK Cancel OK Lab Exercise 1 The loan amount is 1000.00, and the loan duration is 2 year(s). Continue! No Yes Lab Exercise 1 Monthly Payment($) Total Payment($) Interest Rate(%) 5.000 5.125 5.250 5.375 5.500 5.625 5.750 5.875 6.000 6.125 6.250 6.375 6.500 6.625 6.750 6.875 7.000 7.125 7.250 7.375 7.500 7.625 7.750 7.875 8.000 43.87 43.93 43.98 44.04 44.10 44.15 44.21 44.26 44.32 44.38 44.43 44.49 44.55 44.60 44.66 44.72 44.77 44.83 44.89 44.94 45.00 45.06 45.11 45.17 45.23 1052.91 1054.26 1055.60 1056.9!5 1058.30 1059.64 1060.99 1062.34 1063.69 1065.05 1066.40 1067.75 1069.11 1070.47 1071.82 1073.18 1074.54 1075.90 1077.26 1078.63 1079.99 1081.3!5 1082.72 1084.09 1085.45
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
