SYCS-135
INTRODUCTION TO PROGRAMMING
ASSIGNMENT 2
Due Date for Tues./Thurs: Sept. 14, 2000 (Garuba)
Due Date for Mon./Wed./Fri.: Sept. 15, 2000
(Keeling)
PROBLEM: Write a program that simulates the child's game "My Grandmother's
Trunk." In this game, the players
sit in a circle, and the first player names something that goes in the trunk:
"In my grandmother's trunk, I packed a pencil." The next player restates the sentence and
adds something new to the trunk: "In my Grandmother's trunk, I packed a
pencil and a red ball." Each
player in turn adds something to the trunk, attempting to keep track of all the
items that are already there.
Your program should simulate just five turns in the
game. Starting with the NULL string,
simulate each player's turn by concatenating a new word or phrase to the
existing string, and print the results on a new line. Each student should make up his or her own list of items to be
placed in the trunk. The output should be formatted as follows:
**************************************************************
Howard
Student
123456
SYCS-135-01
Introduction
to Programming
Assignment
2
10th
September 2000
Problem:
This program prints out five lines containing concatenated phrases
***************************************************************
In
my Grandmother's trunk, I packed a flower.
In
my Grandmother's trunk, I packed a flower and a shirt.
In my Grandmother's trunk, I packed a flower and a shirt and a cup.
In
my Grandmother's trunk, I packed a flower and a shirt and a cup and a blue
marble.
In
my Grandmother's trunk, I packed a flower and a shirt and a cup and a blue
marble and a ball.
THIS
IS A SAMPLE. YOUR PROGRAM'S OUTPUT SHOULD BE DIFFERENT
Program Output: First print out the your name, Howard U. ID number,
course number and title, assignment number, and date, followed by a description
of the problem. Then print the answer to the problem.
Program Documentation: At the top of your source
code as a comment, include your name, Howard U. ID number, course number and
title, assignment number, and date, followed by a description of the problem
(This same information should also be printed out at the top of your output.
See sample output above). Include comments as necessary throughout your
program.
---------------------------------------------------------
Electronic Submission - SCS Laboratory
All C++ program assignments are now to be submitted electronically. Your
program will be run using the instructors' data. For Assignment 2, name your
C++ program file assign2k.c (for Mon./Wed./Fri - Keeling) or assign2g (for
Tues./Thurs.- Garuba) and use one of
the following commands to submit your program:
$ Keeling assign2k.c (for
Mon./Wed./Fri - Keeling)
$
Keeling assign2g.c (for
Tues./Thurs.- Garuba)
The assignment is to be submitted electronically no later than 10:00pm on Sept.
14, 2000 for Keeling's class and no later then 10:00pm on Sept. 13, 2000 for
Dr. Garuba's class. The receiving file will be closed at 10:00pm and no late
assignments will be accepted. If before the due dates, you send in a version of
your assignment, having already sent in an earlier version, the later version
will automatically replace the earlier version in the assignment file.
---------------------------------------------------------
Electronic Submission via E-mail
If you do not
have an SCS account, your program can be submitted via E mail. If you select
this mode of submission then you must make sure that you make the subject of
your message assign2.c and use the following E mail addresses
[email protected]d.edu
(for Mon./Wed./Fri - Keeling)
[email protected] (for Tues./Thurs.- Garuba)
The
body of the message should be your source code listing with the programs
output as comments.