Question: A program is given to you below. Go through each line and describe what it does by writing notes in the margins. Add necessary data

A program is given to you below. Go through each line and describe what it does by writing notes in the margins. Add necessary data type casting to the lines (The program below does not compile otherwise). Next, fill the table in page #2, with the answer to the corresponding inline comment question as well as the corresponding inputs for dx and dy. import java.util.Scanner; 12 13 public class BasicCalculator { public static void main(String[] args) { Scanner input = new Scanner (System.in); // Variable Declaration int y, x, Z, 22; double dy, dx, dz; float f- 7.12f; System.out.print("Enter a Double Number: "); //Take user input and store it in dy dy = input.nextDouble(); //Prompt the user for another number 14 System.out.print("Enter another Double Number: "); 15 dx = input.nextDouble(); 16 ; // What do you think will happen now? x = dx; // 18 System.out.println(y + ", " + dy); // What is the output in Line #28? System.out.println(x + " " + dx); //What is the output in Line #20? dz = dx + dy; z = dx + dy, f = z; 22 = x + y; System.out.println (z+" " +22+ - + f); 27 // What is the output in Line #26? 28 //Are they the same? If different, explain why are they different? (Write your answer in the Table below for Line #28.) 29 System.out.println(x / y + "," + dx / dyli answer in the Table below for line 128.) 29 System.out.println(x / Y + "," + dx / dy); 30 /What is the output in Line #29? 31 System.out.println( x y + " , " + (int) dx % (int)dy); 32 /What is the output in Line #312 Line #18 Line #20 Line #26 Line 1.2 9.12 3.456 3.56 7.12345678 0.12345678 -3.456 -3.456 -0.0001 -0.1 0.00001
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
