Question
Hello, I need quick help with Java 1) Run the command below in a terminal to display the version of java installed on your computer?
Hello, I need quick help with Java
1) Run the command below in a terminal to display the version of java installed on your computer?
2) List the result of running this command. Command: java -version
3) Download the SimpleCalculator.java file, compile and run it from the command line. List all the commands you use. Is the SimpleCalculator.java file called source code or byte code?
4) Check to see that a file named SimpleCalculator.class is created in the SimpleCalculator.java directory. Explain what this file is.
5) List computer hardware components that are involved to run the program.
6) What does SimpleCalculator.java do?
7) Make an intentional syntax error (also called compile error). Describe the error you made and list the error message.
8) Make an intentional runtime error (also called logic error). Describe the error you made and explain why it is a logical error.
______________________________________________________________________________________________________________________________________________________
import java.util.Scanner;
public class SimpleCalculator { public static void main(String args[]) { Scanner read = new Scanner(System.in); int numD; int numE;
System.out.print(" Enter a number for A: "); numD = read.nextInt(); System.out.print(" Enter a number for B: "); numE = read.nextInt();
// Addition int sum = numD + numE; System.out.println(" =========="); System.out.println(" A + B = " + sum); System.out.println("==========");
// Subtraction int sub = numD + numE; System.out.println(" =========="); System.out.println(" A - B = " + sub); System.out.println("=========="); // Multiplication long times = numD * numE; System.out.println(" =========="); System.out.println(" A * B = " + times); System.out.println("=========="); // Division double division = (double)numD / numE; System.out.println(" =========="); System.out.printf(" A / B = %.2f", division); System.out.println("==========");
// Modulus int mod = numD % numE; System.out.println(" =========="); System.out.println(" A % B = " + mod); System.out.println("=========="); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started