

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Name: ID: Cop2250 (Section 2) Assignment #1 [8 points] Due date 1/25/ Problem 1: Type the following program using NetBeans. Save and compile the program. Fix the error(s), run the code and write down its output. [2 pts] public class Display_p { /* Example 1: Displaying something on the screen public static void main(String [] args) { System.out.println("Programming I IT"); System.out.print("We have about: ") System.out.print(14 * 2); System.out.println(" class sessions during the semester."); } //end of main } //end of class
Problem 2: After Fix the error(s) in Problem 1, remove all lines in the main method , and add the following lines to the main method in problem 1. [2 pts] int x = 4;y = 5;z=3; String s = "Hello"; System.out.println(x + z + s + x + z); System.out.println(z/x + x + s + z/x + x); System.out.println(y*x + (x + s) + (x + y) + x); Is the program correct? If not, please correct it. What is the program output? Problem 3: Remove all lines in the main method of Problem 2 and add the following lines to the main method. [2 pts] i = 5; i = 5 * i++ + ++i * 3; Is the program correct? If not, please correct it. What is the value of i after second statement?