CS 1400 Lab #7: Implementing The Wagon Wheel Odometer


Objectives:

The objective of this assignment is to let you create a working program from pseudo-code.

The problem

The early pioneers came up with a system to measure how far they traveled each day using a system of cogs and wheels. Knowing the diameter of the wagon wheel, and measuring how many times the wheel turned, they were able to calculate how far they traveled each day. In this project you are to design a Graphical User Interface program that allows the user to enter in a wheel diameter in inches, and then displays the number of turns required for the wheel to travel one mile.

The Interface

You should design your own user interface. It does not need to look like the one shown here, but it should at least provide the following:

  • A TextBox, appropriately labeled, where the user enters the diameter of a wagon wheel in inches. This number could contain a decimal part.
  • A TextBox, appropriately labeled, where the program will display the number of turns that the wheel would take to travel one mile.
  • A Button to clear the text boxes and position the cursor in the first TextBox.
  • An Exit Menu item and an About menu item.
the form

Writing The Program

Start Visual Studio and open up the project that you write for lab #6. You should have written pseudo-code for the event handlers required to make this program work. I have one for tabbing out of the top TextBox and one for the clicking on the Button. Using your pseudo-code as a starting point add the code for each step that you have outlined in your pseudo-code. Each line of pseudo-code should be followed by the code that executes that step. Put blank lines in between steps to make your code more readable.

Testing Your Program

After writing the code for each event handler, build and run your code. Pick some numbers for the diameter of the wagon wheel and see if your program calculates the correct number of turns. When you are satisfied that your program works correctly, save all of your files and submit your lab to Canvas. Your program should be completely documented and contain no magic numbers. Submit your project using the instructions outlined in the Course Syllabus, Programming Projects section.

Questions

When you submit your program, add a comment to your submission that provides the answers to the following two questions:

Question #1: Given a wheel diameter of 24 inches, what will the circumference of the wheel be?

Question #2: Write a statement in C# that computes the circumference of a wheel, given its diameter in inches. Let the diameter be stored in a variable named diam. Store the circumference in a variable named circ. Do not use any magic numbers in your statement.

File(s) to Submit:

Place your complete project folder into a zip file and name the zip file
lab_07_your-initials_V1.0.zip. For example, I would name my file lab_07_RKD_V1.0.zip. Submit this assignment as Lab #7 on Canvas. Please do not include any other files in your submission.

Grading Guidelines

Description Points possible

Assignment has been properly submitted to Canvas.

2

Your program works as specified.

3

The answers to the questions in this lab have been included as comments on your submission, and they are correct.

2
Total 7