s 14 marks] Consider the program below 1 import java.util public class PandI pub
ID: 3711969 • Letter: S
Question
s 14 marks] Consider the program below 1 import java.util public class PandI public static void main (Stringt) arga) // ?ntro Syatem.out.printin("Inin INTEREST CALCULATOR") // initialize input Scanner Scanner stdin new Scanner (System.in) 9 10 Dyst an out.printinnruprai 1oan i intatass // Get principal: System.out.printlnINPUT System.out.print(" Amount b Loan (in ) double principal- stdin.nextDouble () System.out.print(" Annual Interest (in ) double interest stdin.nextDouble) 12 13 15 16 17 // Convert from annual interest to daily interest interest /je 100.0 / 3652 18 19 20 21 // add interest to principal for each day of a year double yearEnd principal; 23 24 25 26 27 28 29 30 31 32 for (int i 0i 365; i++) yearEnd yearEnd yearEnd interest: System . out . printf ( "Original-82.2f ", principal) System.out.printf ("Amount Owing 2.2fIn", yearEnd) : System . out . printf ("Interest Cost %2.2f" (yearEnd principal)): The program was compiled using "javac Pandl.java" and produced the following errors: PandI.java:12: error: illegal character PandI.java:12: error' expected PandI.java: 12: error: illegal start of expression PandI. java: 12: error: unclosed string literal system.out.printin (InINPUT: " System.out.printin (InINPUT: ") System.out.printin (InINPUT: ") System. out.print1n ( INPUT:" continued on next page Page 4 of 6Explanation / Answer
Line 12: String has to be in quotation marks.
" INPUT: "
is used to print a new line character and is valid.
Line 19: / = there is a space between them which has to be removed. It is /=
Example a /= 2 means a = a/2
Line 28: There isn't a semi colon at the end of the line.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.