CSE 1311 - Section 2 - Assignments - Assignment 2

Due date: Wednesday, February 10, 2010, 11:55pm.


Task 1 (40 points)

Write a program, in a file called task1.c, that does the following:

  1. Ask the user to input a temperature T in Fahrenheit.
  2. If T is equal to 777.0, the program exits.
  3. Otherwise, the program should convert T from Fahrenheit to Celsius, and print the temperature in Celsius. Have in mind that if the temperature is T degrees Fahrenheit, then the temperature is X degrees Celsius, where X = (T-32) * 5 / 9.
  4. After the program prints the temperature in Celsius, it should go back to step 1.
Your solution must satisfy the following requirements: Optionally, you can submit the following code for partial credit (this may be useful if you cannot solve the entire task):


Task 2 (40 points)

Write a program, in a file called task2.c, that does the following:

Your solution must satisfy the following requirements: Optionally, for partial credit, you can submit:


Task 3 (20 points)

Mr. Bugs wants to write a simple program that prints out all multiples of 7 between 1 and 70. However, to his great chagrin, his program produces an unexpected output. Your task is to find and correct the bug in Mr. Bugs code.

DO NOT SUBMIT SOURCE CODE for this question. Just include, in your answers.doc file, an answer that includes:

Here is the program that Mr. Bugs wrote:
#include <stdio.h>

int main()
{
  int i;
  for (i = 7; i <= 70; i = i+7);
  {
    printf("%d\n", i);
  }
}


How to submit

Submisions are only accepted via WebCT. The submission should include files task1.c, task2.c, answers.doc. Do not submit entire project directories, or anything else except for those three files.

Your answers.doc file should be a single Microsoft Word file that includes:

Make sure that your answers.doc file is easy to parse, and that it is easy for us to figure out which part corresponds to which task. Feel free to use headings such as "start of copy of task1.c".

We try to automate the grading process as much as possible. Not complying precisely with instructions causes a significant waste of time during grading, and thus points will be taken off for failure to comply, and/or you may receive a request to resubmit.

Submission checklist