Write a program that calculates the amount of money earned onan investment; that
ID: 3611574 • Letter: W
Question
Write a program that calculates the amount of money earned onan investment; that amount should include 12 percent interest.Prompt the user to choose the investment amount from one menu andthe number of years for the investmen from a second menu. Displaythe total amount (balance) for each year of the investment. Use aloop instruction to calculate the balance for each year. Use theformula amount = investment * (1 + interest) raised to a powerequal to the year to calculate the balance. Use the Math powerfunction Math.pow(x,y) where x = (1 + interest) and y is theyear. Need to ask if it wants to run again andneeds to be in JOptionPane. Must format money!!! PLEASE HELP! I AM REALLY CONFUSED AND NEED IT URGENTLY!! WILL GIVE BIG POINTS IF DONE CORRECTLY AND HAS EVERYTHING! IREALLY NEED HELP FAST! Thanks. Write a program that calculates the amount of money earned onan investment; that amount should include 12 percent interest.Prompt the user to choose the investment amount from one menu andthe number of years for the investmen from a second menu. Displaythe total amount (balance) for each year of the investment. Use aloop instruction to calculate the balance for each year. Use theformula amount = investment * (1 + interest) raised to a powerequal to the year to calculate the balance. Use the Math powerfunction Math.pow(x,y) where x = (1 + interest) and y is theyear. Need to ask if it wants to run again andneeds to be in JOptionPane. Must format money!!! PLEASE HELP! I AM REALLY CONFUSED AND NEED IT URGENTLY!! WILL GIVE BIG POINTS IF DONE CORRECTLY AND HAS EVERYTHING! IREALLY NEED HELP FAST! Thanks. PLEASE HELP! I AM REALLY CONFUSED AND NEED IT URGENTLY!! WILL GIVE BIG POINTS IF DONE CORRECTLY AND HAS EVERYTHING! IREALLY NEED HELP FAST! Thanks.Explanation / Answer
please rate - thanks import javax.swing.*; public class Interest2 { public static double rate = 0.12; public static void main(String[] args) { String choice = JOptionPane.showInputDialog(null, "DO want tocalculate the amount of money earned on investment (Type Y or N)"); double invest=0.0; int numYears=0; double balance=0.0; while( choice.charAt(0)=='Y' || choice.charAt(0)=='y') { String investment =JOptionPane.showInputDialog(null, "Enter the Investment in dollars(Eg: 100)"); invest =Double.parseDouble(investment); String years = JOptionPane.showInputDialog(null,"Enter the Number of years (Eg: 10)"); numYears = Integer.parseInt(years); balance =invest; String output=""; for(int i=0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.