NetBeans Assignment: Fixing and Running Java Programs - Prof. Erliang Zeng, Assignments of Javascript programming

Instructions for a netbeans assignment, including three programming problems. Students are required to type and compile the given java code, fix any errors, and write down the output. Each problem involves modifying the main method and adding or removing certain lines.

Typology: Assignments

Pre 2010

Uploaded on 03/10/2009

koofers-user-2o9
koofers-user-2o9 🇺🇸

4.5

(2)

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name:
ID:
Cop2250 (Section 2) Assignment #1 [8 points] Due date 1/25/08
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_p1
{
/* 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
pf3

Partial preview of the text

Download NetBeans Assignment: Fixing and Running Java Programs - Prof. Erliang Zeng and more Assignments Javascript programming in PDF only on Docsity!

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?