Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I NEED EXPERT HELP WITH JAVA CODE PLEASE!!! If you know the balance and the annual percentage interest rate, you can compute the interest on
I NEED EXPERT HELP WITH JAVA CODE PLEASE!!!
If you know the balance and the annual percentage interest rate, you can compute the interest on the next monthly payment using the following formula: interest = balance X (annuallnterestRate / 1200) Write a program that reads the balance and the annual percentage interest rate and displays the interest for the next month in two versions: 1. Use dialog boxes to obtain input from the user and display output; 2. Use the console to obtain input from the user and display output. Be sure to provide clear prompts to the user, so that input is entered correctly. Sample Data: Balance = 100000 Annual Interest Rate = 4.625 Interest = 385.41 Language Java Run Debug Stop Share M Save {Beautify Main.java 1 import javx.swing.JOptionPane; 2. public class calculate Interest{ public static void main( E[] args) { String balanceString JOptionPane.showInputDialog("Enter the balance: "); String rateString = JOptionPane.showInputDialog("Enter interest rate(e.g., 3 for 3%):"); double balance = Double.parseDouble(balanceString); double rate = Double-parseDouble(rateString); double interest balance * (rate/1200); String output "The interest is:" + interest ; 14 JOptionPane.showMessageDialog(null, output); 15 } 16 } 17 import java.util.Scanner; 18 class interest{ 19 20 public static void main(String args[]){ 21 Scanner s = new Scanner(System.in); 22 System.out.print("Enter balance and interest rate e.g. 3 for 3%): "); 23 double b = s.nextDouble(); 24 double r s.nextDouble(); 25 double i (float)(b r/ 1200); 26 27 System.out.print("The interest is" + i); 28 } 29 } input Compilation failed due to following error(s). Main.java:17: error: class, interface, or enum expected import java.util.Scanner; 1 error
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started