FloridaTech - College of Engineering

CSE1001 - LABORATORY


To be submitted in the lab

Part 1

Problem

Develop a top down design and write an Ada program to print a calender for one year, given the year and the day of the week that January 1 falls on. It may help to think of this task as printing 12 calenders, one for each month, given the day of the week that a month starts on and the number of days in the month. Each successive month starts on the day of the week that follows the last day of the preceding month. Days of the week should be numbered 0 through 6 for Sunday through Saturday. Years that are divisible by four are leap years. Here is a sample run for an interactive system.

Output

What year do you want a calender for?       <------First prompt
1985                                        <------Entered by the user
What day of the week does January 1 fall on?<------Second prompt
(Enter 0 for Sunday, 1 for Monday, etc.)
2                                           <------Entered by the user

1985

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

February

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

.

.

.

December

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

Things to be turned in :
1. Source code
2. The output of the program


OPTIONAL TAKE HOME PROBLEM

Optional

Part 2

Problem

Develop a top down design and write a program to produce a bar chart of gourmet popcorn production for a cooperative farm group on a cooperative farm group on a farm-by-farm basis. The input to the program will be a series of data sets with each set representing the production for one farm. The output will be a bar chart that identifies each farm and displays its production in pints of corn per acre.

Each data set will consist of two lines. On the first line is the name of a farm. On the second line is a float number representing acres planted, a space, and an Integer number representing pint jars of popcorn produced.

The output will be a single line for each farm, with the name of the farm starting in the first column on a line and bar chart starting in column 30. Each mark in the bar chart will represent 250 jars of popcorn per acre. The production goal for the year is 5000 jars per acre. A vertical bar should appear in the chart for farms with lower production, or a special mark should appear for farms with production greater than or equal to 5000 jars per acre.

The program would generate the bar chart when the user enters 0 on the prompt Please enter the farm name:

Example:

Output 

Please enter the farm name :<------ prompt
Orville's Acres             <------ entered by the user
Please enter the Pint jars of popcorn produced:
114.8    43801
Please enter the farm name :
Hoffman's Hills
Please enter the Pint jars of popcorn produced:
77.2     36229
Please enter the farm name :
Jiffy Quick Farm
Please enter the Pint jars of popcorn produced:
89.4     24812
Please enter the farm name :
Jolly Good Plantation
Please enter the Pint jars of popcorn produced:
183.2    104570
Please enter the farm name :
Organically Grown Inc.
Please enter the Pint jars of popcorn produced:
45.5     14683
Please enter the farm name:
0

              Pop Co-Op

Farm name               Production in Thousands
                        of Pint Jars per Acre
 
                           1   2   3   4   5   6
                        ---|---|---|---|---|---|
Orville's Acres         ***************    |
Hoffman's Hills         *******************|
Jiffy Quick Farm        ***********        |
Jolly Good Plantation   *******************#***
Organically Grown Inc.  *************      |

Things to be submitted :
   1.The source code of the pogram.
   2.The design of the program.
   3.Output of the program.


Professor:Dr.Stansifer
G.S.A : Rishi Gupta
Last Modified :2/28/99