Question: Prof Rudowsky CISC 1115 Lab 1 PART A Write a complete Java program, including a good comment (see sample program below) at the top, to
Prof Rudowsky CISC 1115 Lab 1
PART A
Write a complete Java program, including a good comment (see sample program below) at the top, to do the following:
- Take any version of a simple program that was done in class (for example, see below)
- Type it up in an IDE of your choice, save it, run it and view the output.
- Be sure to include one or more comments giving your name, class, section and the purpose of the program.
- You are required to include this type of comment on every program you write for the course or else it will not be accepted.
- If you change the code of
System.out.println((10.5 + 2 * 3) / (45 - 3.5));
to
System.out.println(((10.5 + 2) * 3) / (45 - 3.5));
What is the output? Explain the difference! Note the change in parentheses!
- Print a copy of the program and a copy of the output from the program.
SAMPLE PROGRAM:
//Ira Rudowsky CISC1115 Lab #1
//This program allows you to compute a mathematical
//expression and see the result on the screen
public class ComputeExpression { public static void main(String[] args) { System.out.print("(10.5 + 2 * 3) / (45 3.5) = "); System.out.println((10.5 + 2 * 3) / (45 - 3.5));
}
}
PART B
- Repeat part A, but this time write your own computation expression
- Type it up. Save it. Run it. View the output
- Print a copy of the program and a copy of the output from the program.
Hand in all the programs, output and explanation of the different outputs in Part A.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
