CS 1400 Lab #6: Introduction to Pseudo-Code


Reading Material

Before working on the programming problem for this lab, you should carefully study the following information:

Objectives:

The objective of this assignment is to introduce you to the concept of pseudo-code, and give you some practice in developing pseudo-code and writing arithmetic expressions in C#.

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 Pseudo-code

Before you start writing the code for this program, you may have to do some research to figure out how to do the math required to solve this problem. Once you understand how to do this, proceed to create your project.

Start Visual Studio and create a new Windows Forms Application. Then lay out your user interface. I wrote my program so that the code to calculate the number of turns was triggered when the user tabs out of the first TextBox. See lab #5 if you want to do it this way. Create the event handlers that you will need to make your program work. I have one for leaving the top TextBox and one for the Button. Do not write any code in your event handlers at this point. Inside of each event handler write the pseudo-code that explains in short English-like phrases each step that must be executed to make that event handler work. Be sure to write a complete method prologue for each event handler.

Questions

When you submit your lab to Canvas, answer these two questions by adding a comment to your submission when you upload the file.

Question #1: Which of the following statements includes a pre-increment of the variable size?
   (a) ++size
   (b) size++
   (c) size = size + 1
   (d) incr(size)

Question #2: Which of the following terms describes the short English-like phrases you use to describe the steps your program will take as it executes?
   (a) a storyboard
   (b) an activity diagram
   (c) pseudo-code
   (d) a method prologue

File(s) to Submit:

When you are satisfied that you have carefully and thoroughly explained each step in your event handlers, save your project and submit it to Canvas. Be sure that you also have a file prologue identifying you as the author for this program. Submit your project using the instructions outlined in the Course Syllabus, Programming Projects section.

Place your complete project folder into a zip file and name the zip file
lab_06_your-initials_V1.0.zip. For example, I would name my file lab_06_RKD_V1.0.zip. Submit this assignment as Lab #6 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

Source code file contains pseudo-code description for the two event handlers required for this problem, in reasonable detail.

3

You have correctly answered the two questions in this lab.

2
Total 7