Please find the remark "for question 3" in the given incomplete program. What should replace the blank line so that an appropriate value for principal will be accepted at runtime? When typing your answer, do NOT put spaces where optional spaces may be placed and do NOT include the ; because it is already given. Type only the missing part (Do not include what is already given).

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

Please find the remark "for question 3" in the given incomplete program. What should replace the blank line so that an appropriate value for principal will be accepted at runtime? When typing your answer, do NOT put spaces where optional spaces may be placed and do NOT include the ; because it is already given. Type only the missing part (Do not include what is already given). 

// Incomplete Program (The Scanner class is used for data entry)
import java.lang.*;
import java.util.*;
public class MoneyInBank {
public static void main(String[] args) {
Scanner keyboard = new Scanner (System.in);
float annualRate = 0;
float quarterlyRate = 0;
0;
double principal
8;
8;
double interest
double finalAmount
(byte) 0;
byte quarter
int year - 0;
// for question 1
System.out.print ("Enter the year: ");
// for question 2
annualRate =
year
System.out.print ("Enter the initial principal: ");
principal - ;
System.out.printin();
System.out.printf("%s%.2f%n", "Principal = ", _
System.out.printf ("%5%.2f%c%n", "Annual Interest Rate = ", annualRate * 100, '%');
System.out.printf ("%-65%-85%-165%-30s%n", "Year", "Quarter", "Interest Earned",
// for question 3
_); // for question 4
"Amount at the end of quarter");
// for question 5
quarterlyRate
quarter = 1;
interest =
// for question 6
finalAmount = printcipal + interest;
System.out.printf("%-6d%-8d%-16.2f%-30.2f%n", year, quarter, interest, finalAmount);
principal = final Amount;
quarter =
// for question 7
// for question 8
+ interest;
finalAmount = principal
System.out.printf("%-6d%-8d%-16.2f%-30.2f%n", year, quarter, interest, finalAmount);
principal = finalAmount;
// for question 9
// for question 10
// for question 11
finalAmount =
System.out.printf("%-6d%-8d%-16.2f%-30.2f%n", year, quarter, interest, finalAmount);
// for question 12
// for question 13
// for question 14
// for question 15
System.out.printf("%-6d%-8d%-16.2f%-30.2f%n", year, quarter, interest, finalAmount);
System.exit (8);
// end of the main method
// end of the class
Transcribed Image Text:// Incomplete Program (The Scanner class is used for data entry) import java.lang.*; import java.util.*; public class MoneyInBank { public static void main(String[] args) { Scanner keyboard = new Scanner (System.in); float annualRate = 0; float quarterlyRate = 0; 0; double principal 8; 8; double interest double finalAmount (byte) 0; byte quarter int year - 0; // for question 1 System.out.print ("Enter the year: "); // for question 2 annualRate = year System.out.print ("Enter the initial principal: "); principal - ; System.out.printin(); System.out.printf("%s%.2f%n", "Principal = ", _ System.out.printf ("%5%.2f%c%n", "Annual Interest Rate = ", annualRate * 100, '%'); System.out.printf ("%-65%-85%-165%-30s%n", "Year", "Quarter", "Interest Earned", // for question 3 _); // for question 4 "Amount at the end of quarter"); // for question 5 quarterlyRate quarter = 1; interest = // for question 6 finalAmount = printcipal + interest; System.out.printf("%-6d%-8d%-16.2f%-30.2f%n", year, quarter, interest, finalAmount); principal = final Amount; quarter = // for question 7 // for question 8 + interest; finalAmount = principal System.out.printf("%-6d%-8d%-16.2f%-30.2f%n", year, quarter, interest, finalAmount); principal = finalAmount; // for question 9 // for question 10 // for question 11 finalAmount = System.out.printf("%-6d%-8d%-16.2f%-30.2f%n", year, quarter, interest, finalAmount); // for question 12 // for question 13 // for question 14 // for question 15 System.out.printf("%-6d%-8d%-16.2f%-30.2f%n", year, quarter, interest, finalAmount); System.exit (8); // end of the main method // end of the class
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
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