Chapter 3b Programs

 

(Strings, String Functions, String Operators)

 

Mad Libs

Pig Latin

Jersey

 

 

Mad Libs

 

Overview:  You will create a program that will be primarily text based and works with string variables.  You will create a story similar to a “Mad Lib” where the user fills in nouns, verbs, adjectives, names…etc and the program inserts these user supplied words into random spots in the story without the user knowing the context in which they will be used.  There are various copies of different Mad Libs available from this website.

 

Specifics:

 

The program should prompt the user for all of the information before printing the story and then print the story after the information is stored within string variables. Two subroutines should be used...gather.info and print.story.

 

No input should be seen when the completed story is displayed.  That is, clear the user input before the story output.

 

The program will be graded based on the neatness of output and conformity to specific directions.

 

 

 

 

Pig Latin Program

 

Overview:  Create a program that translates any word in English into Pig Latin.  To do this, chop off the first letter of the word, put it on the end along with an “ay”.  For instance, the word “Dog” would become Ogday.  Cat would become Atcay, Hippo would become Ippohay…so on and so forth. 

 

Specifics:

        

The program must be divided into three subroutines:

         Get.English

         Translate

         Show.Pig

 

Sample Output:

 

Enter a word in English?  Monkey

 

English Version:  Monkey

Pig Latin Version:  onkeyMay

 

 

 

 

Team Jerseys

 

Overview:  You manage a company that embroiders letters, names, numbers, and such onto the back of the t-shirts and jerseys.  You charge by the letter and would like a program that helps you compute the cost of your services for different customers.

 

Specifics:  First, you must ask the user their first name, last name, jersey number, and a four-digit id number (just used as a customer id number, not in calculating prices.)

 

From there, you program will process the following info:

         Customer account number

         Cost for last name only

         Cost for first name only

         Cost for full name only

         Cost for numbers only

         Cost for last name with numbers

Cost for first name with numbers

Cost for full name with numbers

 

Store Policies / Pricing

 

 

 

 

 

Sample Output / Test Data

 

First Name?  Matt

Last Name?  Offenbecker

Jersey Number?  22

ID? 1234

 

Pricing Report for customer:  MO1234

Last Only: $1.98

First Only: $.72       

Full Only: $2.7

Numbers Only: $.96

Last with Numbers: $2.94

First with Numbers: $1.68

Full with Numbers: $3.66