Types_Of_Errors

Types_Of_Errors - Project 1: Report By: James Chung Date:...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Project 1: Report By: James Chung Date: October 6, 2007 Class: CS 31 – Lecture 3 Project 1 is the first project of our CS 31 class, and introduces the student to several of the errors made in programming. Step 5 asks the user to input numbers that will create “nonsensical results from reasonable input”. To fulfill this goal, I told the program that I went 20 miles, but used 0 gallons. When taking a look at the formula for MPG, it is distance divided by gallons used, and if we use the values that I put in, the program would be dividing by 0. This is undefined, and the program sends out a huge number (10000000000…etc). Also in another case, I told the program that I traveled -10 miles, which doesn’t make sense because distance is always positive. Then, I said that 2 gallons were used, and for output it says that I get -5 miles per gallon. Although no error was created and the math is technically correct, this set of data obviously does not make sense, because distance as well as miles per gallon is not suppose to have a negative value associated
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/22/2008 for the course CS 1 taught by Professor Rohr during the Spring '08 term at UCLA.

Ask a homework question - tutors are online