Description
Part A – Submit to the Instructor
1. [30 marks] Once you have prepared your computers to do the assignments (or you can use the lab computers), you are to create each of the sample programs shown in Listings 2.4, 2.5, 2.6, 2.8, 2.9, and 2.10 (pages 43 & 65) from Chapter 2 of the textbook. Use the same filename as indicated in Chapter. For example, for Listing 2.4, the file will be named ComputeAreaWithConstant.java. This name is case sensitive – so make sure the W is capitalized and all the other letters are in lower case.
Once you have entered the programs and have them running, create a single Word (or Word compatible) document file. In it, show the following: a. At the top of the first page, enter your name, course code, assignment number and date.
b. A copy of the code you typed into Eclipse. Use the copy and paste features of Eclipse (or Ctrl-C and Ctrl-V) to add this to the document. It is important that the code is text in case I want to run the program myself.
c. Follow the code with a screen capture of the executing program. To create the screen capture, I recommend the “Snipping Tool” to create the images.
Repeat steps a. through c. for each of the six programs.
2. Listings 1.4, 1.5 and 1.6 (pages 20-21) are programs which generate Syntax errors, Logical errors, and Runtime errors respectively. For each of these programs:
a. [15 marks] Recreate all three programs as shown in the textbook, run them. Copy the code for each of the three programs along with a screen capture of the erroneous output.
b. [15 marks] Correct the errors as shown in the textbook, run them again. Copy the code for each of the three programs along with a screen capture of the corrected output.
COSC 1046 (F17) – Introduction to Computer Science 3. [10 marks] Write a java program that displays your last name on the monitor using the * character to from the outline. Your name should be at least 6 lines high. Look at Problem 1.3 (Page 30) as an example. Note that each line is displayed with the method “System.out.println”.
* *** * *** *** ******* * * * * * * * * * * * * * * * * * ******* * * * * ***** * * * * * * * * * * * * * * * * * ******* * * *** *** *** *******
Copy the code for your program long with the screen capture of the output into your word file. Your code will likely wrap in the Word file and look awful – don’t worry about this I am expecting the problem.
This assignment is to be submitted to the instructor in the form of a Word (or Open Office) document containing the Java code and appropriate screen capture(s) of the output. The file name must be in the form ASSIGN1A_YourName where ‘YourName’ is your last name followed by your first name with no space. Upload the file to CMS.