CSC 1750 Introduction to Algorithms

Fall 2009

Exam 1 -- Extra Questions

 

Use these questions in one of two ways:

A.    To replace your score for questions Part III and Part IV in the exam

a.        Each question is worth 10 points for a total of 30 points.

B.     As extra credit.  You keep your current score for questions in Part III and Part IV in the exam and get extra credit

a.       Each question is worth 5 points for a total of 15 points.

 

You must select A or B when you turn in the homework.

 

Answers are due not later than Friday September 18, 2009 at 5 p.m.  Email your programs to me, and be sure to include your selection of A or B from above.

 

Your programs should contain a comment at the beginning with your name, the course number, and the date you submit the program.

 

  1. Extract the program Welcome.java from Exam1Extra.zip file in the CSC1750 web page under handouts tab.  Identify and fix the errors in the code.  Use comments at the end of the line that contains an error or errors to identify the error or errors on that line and then fix the error or errors.  Eventually, the program should compile and run.  Email the corrected code to me.

 

  1. Extract the program Test.java from Exam1Extra.zip file in the CSC1750 web page under handouts tab.  Identify and fix the errors in the code.  Use comments at the end of the line that contains an error or errors to identify the error or errors on that line and then fix the error or errors.  Eventually, the program should compile and run.  Email the corrected code to me.

 

  1. Write a program named Expression.java to implement the following equation:

 

 

Initialize the variables to the following values:

r = 2.5

a = 3.0

b = 2.0

c = 0.35

d = 4.2

 

Display the values of z.