SYCS-135
INTRODUCTION TO PROGRAMMING
ASSIGNMENT 9
Due Date for Tues./Thurs: November 9,
2000 (Garuba)
Due Date for Mon./Wed./Fri.: November
10, 2000 (Keeling)
Problem: You have been
hired by a company that produces personal digital assistants. Your assignment
is to write a part of the software that prints out calendars for any given
year. The project leader has produced
that structure chart below for your program.
You are to write a program that is structured in the manner depicted in this structure chart. That is, you will need at least 6 functions, including main. The parameters for these functions are indicated on the chart. The call-by-reference parameters are depicted as double-headed arrows and the call-by-value parameters are depicted by arrows that point at the module symbol. The read_month_data function should read the name of each month and the number of days from a file called month_data.dat that you should create using a text editor. The first few records in this file are listed below:
January 31
February 28
March 31
April 30
June 30
The integer following the month name is the number of days in each month.
Output: Your
output should present, in a neat and readable manner, your name, the course
number, assignment number and date, problem description and each month of the
year, in the following format:
YEAR
-- 2000
January
S | M | T | W |T | F | S |
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Hint: You will need to set up a loop in main that calls both the read_month_data function and the print_month functions 12 times. In the print_month function, set up a nested loop. The outside loop prints each week (up to 6 weeks per month) and the inner loop print the integer date for each day of the week (Sun.=1, Mon.=2, ). The key is to determine the day of the week for the first day of each month. The day of the week for the first day of the year (January 1st) is entered by the user during the execution of the get_starting_date function. Use the last_day parameter (from the previous month) to determine first day of the next month. Once you determine the first day of the month you can tab over (cout << \t) enough times to get the 1st date under the proper heading.
Special Requirements: Your program must use function prototypes, call by value and call by reference parameters.
Assignment Submission: On November 10th for Keeling and November 9th for Garuba, hand in a
hard copy of your algorithm in pseudocode, your C++ program compilation
listing, and your output obtained from running your program. You will have to
write your output to a file in order to get all 12 months printed. SCS users
will also submit their programs electronically on November 9th
(Keeling) or November 8th
(Garuba), see below.
Pseudocode: A 1-page description of your algorithm in pseudocode
for each function.
Test Oracle: No test oracle is required.
Program Documentation: At the top of your source code as a comment, include your name, course number and title, assignment number, and date, followed by a description of the problem. Include comments as necessary throughout your program to illustrate the algorithm, logic of flow, meaning of variables etc. Follow the style guidelines described in class.
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 9, name your
C++ program file assign9k.c (for Mon./Wed./Fri - Keeling) or assign9g (for
Tues./Thurs.- Garuba) and use one of the following commands to submit your
program:
$ Keeling assign9k.c (for
Mon./Wed./Fri - Keeling)
$ Keeling assign9g.c (for Tues./Thurs.- Garuba)
The assignment is to be submitted electronically no later than 10:00pm on
Nov. 9, 2000 for Keeling's class and no later then 10:00pm on Nov. 8, 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 assign9.c and use the following E mail
addresses
[email protected]
(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.