Google Answers Logo
View Question
 
Q: Visual C++ ( No Answer,   0 Comments )
Question  
Subject: Visual C++
Category: Computers > Programming
Asked by: maulik1710-ga
List Price: $20.00
Posted: 26 Aug 2003 21:58 PDT
Expires: 25 Sep 2003 21:58 PDT
Question ID: 249133
Program Specification
A weather station operator has been recording average daily
temperatures for a number of
years. Each day at 3:00am, 9:00am, 3:00pm and 9:00pm, the temperature
is manually
recoded in a notebook. After taking the 9:00pm reading the average
daily temperature is
calculated by adding four readings and dividing the sum by four. The
average daily
temperature is then also manually recorded in the notebook. On the
last day of each
month the average monthly temperature is calculated and stored in a
computer text file to
a precision of 2 decimal places. Past records show that the average
monthly temperature
has never fallen below 0.00 degrees Celsius, and has never risen above
50.00 degrees
Celsius.
The operator has already made text files that record the average
monthly temperatures for
2001 and 2002. The files have been saved on computer with the file
names data2001.dat
and data2002.dat. The file for 2003 has been started, but is not yet
complete. It is stored
in the file named data2003.dat.
Each data file contains a set of month names and average monthly
temperatures. Each
month name and average monthly temperature is on a separate line. The
data stored in
the file data2002.dat is shown below:
January 35.54
February 28.62
March 22.01
April 21.23
May 15.08
June 18.92
July 13.75
August 21.73
September 24.35
October 28.96
November 29.47
December 32.78
The program starts by displaying a menu as shown below:
MENU
1. Select a year to work with
2. Display data as a table
3. Display data as a vertical histogram
4. Display yearly statistics to date
5. Record data
6. Change data
7. Store the current data
0. Exit the program
Please enter a number (0..7) ==>
When option 1 is chosen the program asks the user to specify the year
to be analysed. If
a data file for that year exists the data from that file is loaded
into the program for
processing. (Depending on your implementation, one or two arrays may
be used for this
purpose.) The program then returns to the menu display. If a file for
that year does not
exist the program should ask the user if a file should be created. If
a file is to be created
then the program should do so and prepare to start recording data for
that year, starting at
month one (January), and then return to the menu display. If the user
does not want to
create a file then the program should just return to the menu display.
If the user was
amending a file then that data should be saved to its file, a new file
is opened and the data
loaded into memory.
When option 2 is chosen the program displays the data from the
currently selected year
file, in a table, 3 columns wide, and with as many rows as required to
display all of the
available temperature data. In the example display format shown below
average monthly
temperatures have been recorded for the first five months of the year.
Table of temperature data for 2003
Quarter 1 37.71 31.70 27.89
Quarter 2 24.50 23.05
After displaying the data, the program returns to the menu display. If
a year has not been
specified, the user should be informed that there is no data to
display before being
returned to the menu display.
Option 3 displays the data as a vertical histogram. The histogram
shows the temperature
for each month as a horizontal line of stars. The length of the line
of stars is proportional
to the temperature, rounded to the nearest whole number. For instance,
if each star
represents one degree Celsius, then a reading of 26.07 degrees is
represented by 26 stars,
whereas a reading of 26.78 degrees is represented by 27 stars. The
average temperature
for each month, starting with month 1 (January) at the top, should be
displayed on
successive lines down the screen. The temperature scale should be
shown at the top and
bottom of the histogram. The abbreviated month name appears at the
left-hand side of
each row (as shown below). After completion of the option the program
returns to the
menu display. If a year has not been specified, the user should be
informed that there is
no data to display before being returned to the menu display.
Histogram of temperature data for 2000
000000000011111111112222222222333333333344444444445
012345678901234567890123456789012345678901234567890
Jan ************************************
Feb ******************************
Mar ***********************
Apr **********************
May ****************
Jun ********************
Jul ***************
Aug ***********************
Sep *************************
Oct ******************************
Nov ******************************
Dec **********************************
000000000011111111112222222222333333333344444444445
012345678901234567890123456789012345678901234567890
Option 4 displays statistics of the data for the specified year. The
highest, lowest and
average temperatures recorded in the specified year are displayed in a
neat format.
Precautions should be taken to guard against the situation where there
is not yet any data
recorded for that year. (You should prevent your program from trying
to divide by zero).
After completion of the option the program returns to the menu
display. If a year has not
been specified, the user should be informed that there is no data to
display before being
returned to the menu display.
Temperature statistics for 2002
Highest monthly average: 35.54
Lowest monthly average: 13.75
Average yearly temperature: 24.37
Option 5 allows the user to enter more monthly average temperatures to
the current data.
Data may be entered for successive months, starting at the month
following the current
latest entry. For example, if data has currently been entered for the
year 2003 up to and
including the data for March, the user may enter data for April, May,
..., December, in
that order. After completion of the option the program returns to the
menu display. If a
year has not been specified (Option 1), the user should be so
informed, before being
returned to the menu display.
Option 6 allows the user to change the average temperature for a
particular month, for
the current year. After completion of the option the program returns
to the menu display.
If a year has not been specified (Option 1), the user should be so
informed, before being
returned to the menu display.
Option 7 will transfer the data currently held in memory into its
appropriate file, and then
return to the menu display. The data remains in memory.
Option 0 saves any temperature data changes to file and then exits the
program.
Assessment Criteria
Criteria Marks
Program Executes correctly 3.0
Programming style – indentation, comments 1.0
Properly constructed multi- file project 2.0
Option implementation:
Select Year 2.0
Display Data 1.0
Display Histogram 1.0
Display Statistics 1.0
Enter data 1.0
Alter data 1.0
Save data 1.0
Report Question 1.0
Penalties:
Late penalties. As per Faculty policy at 5% per day.
Plagiarism/Cheating Penalties.
********************************************************************************
I need help with the arrays, max 2d arrays

Request for Question Clarification by maniac-ga on 27 Aug 2003 16:47 PDT
Hello maulik1710,

After reading through your question more than once, I would like to
make sure you get a suitable answer. Your request that follows the
program description asks...
  I need help with the arrays, max 2d arrays
I can provide suggestions related to
 - an array used to store the names of months
 - an array used to store the average monthly temperatures
 - reading from a file and filling the arrays
 - writing the array data to a file 
as well as some general guidance on program design / implementation. I
can also provide code examples (or point to on line resources for
similar tasks) as well.

Please indicate if this would be acceptable as an answer and if there
are any other constraints (e.g., time limit) that would apply.
  --Maniac

Clarification of Question by maulik1710-ga on 27 Aug 2003 22:33 PDT
Program Specification 
A weather station operator has been recording average daily 
temperatures for a number of 
years. Each day at 3:00am, 9:00am, 3:00pm and 9:00pm, the temperature 
is manually 
recoded in a notebook. After taking the 9:00pm reading the average 
daily temperature is 
calculated by adding four readings and dividing the sum by four. The 
average daily 
temperature is then also manually recorded in the notebook. On the 
last day of each 
month the average monthly temperature is calculated and stored in a 
computer text file to 
a precision of 2 decimal places. Past records show that the average 
monthly temperature 
has never fallen below 0.00 degrees Celsius, and has never risen above 
50.00 degrees 
Celsius. 
The operator has already made text files that record the average 
monthly temperatures for 
2001 and 2002. The files have been saved on computer with the file 
names data2001.dat 
and data2002.dat. The file for 2003 has been started, but is not yet 
complete. It is stored 
in the file named data2003.dat. 
Each data file contains a set of month names and average monthly 
temperatures. Each 
month name and average monthly temperature is on a separate line. The 
data stored in 
the file data2002.dat is shown below: 
January 35.54 
February 28.62 
March 22.01 
April 21.23 
May 15.08 
June 18.92 
July 13.75 
August 21.73 
September 24.35 
October 28.96 
November 29.47 
December 32.78 
The program starts by displaying a menu as shown below: 
MENU 
1. Select a year to work with 
2. Display data as a table 
3. Display data as a vertical histogram 
4. Display yearly statistics to date 
5. Record data 
6. Change data 
7. Store the current data 
0. Exit the program 
Please enter a number (0..7) ==> 
When option 1 is chosen the program asks the user to specify the year 
to be analysed. If 
a data file for that year exists the data from that file is loaded 
into the program for 
processing. (Depending on your implementation, one or two arrays may 
be used for this 
purpose.) The program then returns to the menu display. If a file for 
that year does not 
exist the program should ask the user if a file should be created. If 
a file is to be created 
then the program should do so and prepare to start recording data for 
that year, starting at 
month one (January), and then return to the menu display. If the user 
does not want to 
create a file then the program should just return to the menu display. 
If the user was 
amending a file then that data should be saved to its file, a new file 
is opened and the data 
loaded into memory. 
When option 2 is chosen the program displays the data from the 
currently selected year 
file, in a table, 3 columns wide, and with as many rows as required to 
display all of the 
available temperature data. In the example display format shown below 
average monthly 
temperatures have been recorded for the first five months of the year. 
Table of temperature data for 2003 
Quarter 1 37.71 31.70 27.89 
Quarter 2 24.50 23.05 
After displaying the data, the program returns to the menu display. If 
a year has not been 
specified, the user should be informed that there is no data to 
display before being 
returned to the menu display. 
Option 3 displays the data as a vertical histogram. The histogram 
shows the temperature 
for each month as a horizontal line of stars. The length of the line 
of stars is proportional 
to the temperature, rounded to the nearest whole number. For instance, 
if each star 
represents one degree Celsius, then a reading of 26.07 degrees is 
represented by 26 stars, 
whereas a reading of 26.78 degrees is represented by 27 stars. The 
average temperature 
for each month, starting with month 1 (January) at the top, should be 
displayed on 
successive lines down the screen. The temperature scale should be 
shown at the top and 
bottom of the histogram. The abbreviated month name appears at the 
left-hand side of 
each row (as shown below). After completion of the option the program 
returns to the 
menu display. If a year has not been specified, the user should be 
informed that there is 
no data to display before being returned to the menu display. 
Histogram of temperature data for 2000 
000000000011111111112222222222333333333344444444445 
012345678901234567890123456789012345678901234567890 
Jan ************************************ 
Feb ****************************** 
Mar *********************** 
Apr ********************** 
May **************** 
Jun ******************** 
Jul *************** 
Aug *********************** 
Sep ************************* 
Oct ****************************** 
Nov ****************************** 
Dec ********************************** 
000000000011111111112222222222333333333344444444445 
012345678901234567890123456789012345678901234567890 
Option 4 displays statistics of the data for the specified year. The 
highest, lowest and 
average temperatures recorded in the specified year are displayed in a 
neat format. 
Precautions should be taken to guard against the situation where there 
is not yet any data 
recorded for that year. (You should prevent your program from trying 
to divide by zero). 
After completion of the option the program returns to the menu 
display. If a year has not 
been specified, the user should be informed that there is no data to 
display before being 
returned to the menu display. 
Temperature statistics for 2002 
Highest monthly average: 35.54 
Lowest monthly average: 13.75 
Average yearly temperature: 24.37 
Option 5 allows the user to enter more monthly average temperatures to 
the current data. 
Data may be entered for successive months, starting at the month 
following the current 
latest entry. For example, if data has currently been entered for the 
year 2003 up to and 
including the data for March, the user may enter data for April, May, 
..., December, in 
that order. After completion of the option the program returns to the 
menu display. If a 
year has not been specified (Option 1), the user should be so 
informed, before being 
returned to the menu display. 
Option 6 allows the user to change the average temperature for a 
particular month, for 
the current year. After completion of the option the program returns 
to the menu display. 
If a year has not been specified (Option 1), the user should be so 
informed, before being 
returned to the menu display. 
Option 7 will transfer the data currently held in memory into its 
appropriate file, and then 
return to the menu display. The data remains in memory. 
Option 0 saves any temperature data changes to file and then exits the 
program.

Request for Question Clarification by maniac-ga on 28 Aug 2003 05:16 PDT
Hello Maulik1710,

What kind of help are you asking for with this program?

1. Do you want a program that can be built by Visual C++ and run on a
Windows PC?

OR

2. Do you want help on program design and use of arrays so you can
write such a program?

Please note that if this is homework, you may be unable to submit an
answer based on #1 due to your school's policy on plagiarism. You are
also more likely to get an answer to #2 based on the price you are
offering. The program specification is quite clear - what do you want
related to this specification?

  --Maniac

Clarification of Question by maulik1710-ga on 28 Aug 2003 17:49 PDT
hi

               this is not for my school submission. i have already
finished 
my studies but i have still problems with the arrays. i have to do one 
project in my company based on this programme. so, please don't worry and 
send me the solution as soon as possible.

                                thanks.
                                                maulik.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy