DOC PREVIEW
UNC-Chapel Hill COMP 004 - Lab-08B - Simple Programming

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

COMP 4, Summer 2005 – Session IILab-08B: Simple ProgrammingTotal Points Possible: 30Due Date: Wednesday, 20 July 2005 at 1:15 PM (start of class)TURN INCOMP 4, Summer 2005 – Session IILab-08B: Simple Programming………………………………………………………………………………………………………Total Points Possible: 30Due Date: Wednesday, 20 July 2005 at 1:15 PM (start of class)………………………………………………………………………………………………………After attending class and completing this assignment, you should be familiar with basic programming. In detail, you should know the following fundamental concepts. (Read L to R)put command Variable declarations Arithmetic expressions get commandInteger, real, string data types Editor Window Run Window Error Viewer WindowComments (%)NOTE: All programs must be written in the Turing Programming Language; please use Turing 4.0.2.PICK UP HANDOUTS- Turing Worksheet APROGRAMS NEEDED- Turing 4.0.2 (refer back to Turing Worksheet INTRO for all details!)…………………………………………………………………………………………………………………………SECTION I: LEARN & PRACTICE: Sample ProgramsA. Getting Familiar: 1. You should have already completed Worksheet Intro and Worksheet A by now. (No need to do Worksheet B just yet).…………………………………………………………………………………………………………………………SECTION II: A "Simple Sequence" Program (FOR POINTS)CRITICAL INFO 1. SAVING Turing programs you write. Save your program often. For this assignment, name your program: Lab08B- MadLib-LastFirst.tNote! Use the correct file name extensionthe t, else it may not be recognized by Windows later.2. Remember to OPEN any Turing program files from within the Turing program itself. (Consult lab-08A if you need a refresher.)3. You need to master only the concepts taught in the first Turing lecture (Lec12) and in Worksheets Intro and A to complete this assignment. Concepts you will learn in the other Turing lectures (and in Worksheets B & C) are required only for Lab-09.What’s coming…While your company is a success, you can’t help but feel like adding a little spice to office life. To improve company morale, you institute a Fun Friday, where each employee completes a “Mad Lib” featuring whatever words they want, for the fun and amusementof everyone.PURPOSE, and DESIRED OUTPUTPURPOSE, and DESIRED OUTPUTYou will design, write, and test a Turing program that takes input from a user and generates a zany “Mad Lib”. It will produce (display on the screen) a “Mad Lib” featuring a hilariously random set of adjectives, nouns, etc. The program will prompt the userfor a series of words, and then generate the “Mad Lib”. The OUTPUT specifications are described within Minimum Requirements, below.MINIMUM REQUIREMENTS:A. DESIRED OUTPUT:Refer to the attached sheet for an example of what your output might look like. Your completed program must create a “Mad Lib”. (Output specifications provided below.)B. USER INPUT:You should anticipate that the person who runs your program knows nothing about programming. All of this (and what it means to write a user-friendly program) is explained in this very section in Lab-08A-re-read that section as needed.C. PROCESSING:Remember the data processing cycle: INPUT-Store-PROCESSING-Store-OUTPUT. However, there will be no "number crunching"-type processing in this program. The main task here is to simply display the “Mad Lib” correctly. 1. Explain to the user (creator of “Mad Lib” results) what this program will do. Remember that he or she would not see nor understand your code. Don't use programmer jargon (like program, variable, etc.). However, make sure all your code is properly commented-refer to the TURING ASSIGNMENTS: Rules, Hints, Reserved Words handout. Please declare all variables at the beginning for easier readability. Also, please comment each part of the Minimum requirements. (Refer back to the Turing Guidelines handout you were given.)2. Prompt the user for any first name. Store the name in a variable that can handle white spaces.Reminder: 1) After each part of the Minimum requirements you may want to test your program for errors. This will help you identify exactly where problems are. It is much harder to find errors in your program if you don't run it until you are finished with it! 2) The variables you create are case sensitive. That means: name is not the same as Name.3. Prompt the user for any noun (maybe provide an example or two). Store this noun in a different variable. [Save your program often!]4. Prompt the user for an adjective (again, provide an example). Store this adjective in a different variable.5. Prompt the user for a verb in the present tense (provide an example). Store this verb in a different variable.6. Prompt the user for an adverb (provide an example). Store this adverb in a different variable.7. Next, prompt the user for a second noun. Remember not to confuse this with the first noun. Store this second noun in a different variable.8. Finally, prompt the user for the name of a famous person. This should come from a list of options which you provide, much like the following example:Choose a famous person:ElvisChris RockBob DoleDonkey KongMickey MouseYou MUST supply your own answers-don’t use ours. And your list must include at least four names.OUTPUT SPECIFICATIONSOUTPUT SPECIFICATIONS1. Now (after the code you’ve written thus far), enter the code for clear screen. Then type the code, which will produce the “Mad Lib” appearing after step 3 (beginning “Once…”). Note that the underlined text in our sample letter below is simply our way of pointing out to you the stored variables that would go in each spot (there’s nothing you have to underline in your output). You will substitute the underlined text with your own variables.22. If you make sure that the displayed lines END at exactly the same places as shown in our example below, the next requirement should work correctly for you. IN ADDITION: Your code must have at least one statement that will cause at least one single line of output to display a variable embedded within two character strings; that is: a text string, a variable, then a text string (such as the 1st, 2nd, and


View Full Document

UNC-Chapel Hill COMP 004 - Lab-08B - Simple Programming

Download Lab-08B - Simple Programming
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab-08B - Simple Programming and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab-08B - Simple Programming 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?