A bank account earns interest once per year. Compute the interest earned in the first and second years. Investment.java 1 public class Investment 2 { 3 4 5 public static void main(String[] args) { double balance = 351.75; double percent = 5.5; 7 8 double interest = balance percent; System.out.printf("Year 1 interest: %.2f%n", interest); 9 10 11 12 interest = balance percent; 13 14 15 } System.out.printf("Year 2 interest: %.2f%n", interest); }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 15PE
icon
Related questions
Question

A bank account earns interest once per year. Compute the interest earned in the first and second years.

 

A bank account earns interest once per year. Compute the interest earned in the first and second years.
Investment.java
1 public class Investment
2 {
3
4
5
public static void main(String[] args)
{
double balance = 351.75;
double percent = 5.5;
7
8
double interest = balance
percent;
System.out.printf("Year 1 interest: %.2f%n", interest);
9
10
11
12
interest = balance
percent;
13
14
15 }
System.out.printf("Year 2 interest: %.2f%n", interest);
}
Transcribed Image Text:A bank account earns interest once per year. Compute the interest earned in the first and second years. Investment.java 1 public class Investment 2 { 3 4 5 public static void main(String[] args) { double balance = 351.75; double percent = 5.5; 7 8 double interest = balance percent; System.out.printf("Year 1 interest: %.2f%n", interest); 9 10 11 12 interest = balance percent; 13 14 15 } System.out.printf("Year 2 interest: %.2f%n", interest); }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT