Lab 6 Dynamic Arrays/Files Solution

$30.00 $24.00

PROGRAM SPECIFICATIONS Meteorologists love to keep statistics on the weather. They often tell us the maximum temperature for some date, or the minimum value for some date, or even how long it has been since Spokane experienced a 60 degree day. Your task is to use dynamic arrays provide some of the same statistics that…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

PROGRAM SPECIFICATIONS

Meteorologists love to keep statistics on the weather. They often tell us the maximum temperature for some date, or the minimum value for some date, or even how long it has been since Spokane experienced a 60 degree day. Your task is to use dynamic arrays provide some of the same statistics that a meteorologist does.

Your task:

  • Your data will come from a file named temps.txt – My code prompts the user for the filename.

  • The first line in the file will contain the number of days

  • The file will then contain that number of entries for the number of days, one per line.

  • Create an array of the exact size needed

  • Fill the array with the values from the file.

  • Repeatedly display the menu that has the following choices

    1. Find and display the max temperature

    1. Find and display the min temperature

    1. Find and display the mean (average) temperature for the month

    1. Find and display the median temperature for the month

    1. Find and display the mode temperature for the month – if all the same then the lowest temp

    2. Allow the user to load a new file

    1. Quit

You must range check menu entries

I have provided cscd240Lab6.c – As always you can’t change my main

TO TURN IN

A zip file that contains Lab6 folder and: – You better know the naming scheme by now

  • All your code required to compile and execute your program

  • A valgrind run to show you don’t leak memory named cscd240lab6val.txt

  • An output run of your program named cscd240lab6out.txt

  1. At least 2 runs over your program and make sure you test everything

SAMPLE RUN / SAMPLE FILE

28

12

14

12

10

-2

-5

12

14

16

18

20

22

21

23

15

12

10

18

19

20

21

22

23

24

25

26

27

28

Welcome to the Weather Program

I have read that there are 28 temperatures.

Please choose from the following:

  1. Display the max temperature

  2. Display the min temperature

  1. Display the mean temperature for the month

    1. Display the median temperature for the month

    1. Display the mode temperature for the month

    1. Load a new file

    1. Quit

Choice –> -2

Invalid selection please try again

Please choose from the following:

  1. Display the max temperature

  1. Display the min temperature

  1. Display the mean temperature for the month

    1. Display the median temperature for the month

    1. Display the mode temperature for the month

    1. Load a new file

    1. Quit

Choice –> 1

The maximum temperature was: 28

Please choose from the following:

  1. Display the max temperature

  1. Display the min temperature

  1. Display the mean temperature for the month

    1. Display the median temperature for the month

    1. Display the mode temperature for the month

    1. Load a new file

    1. Quit

Choice –> 2

The minimum temperature was: -5

Please choose from the following:

  1. Display the max temperature

  2. Display the min temperature

  1. Display the mean temperature for the month

    1. Display the median temperature for the month

    1. Display the mode temperature for the month

    1. Load a new file

    1. Quit

Choice –> 4

I have read that the temperatures are for March and there are 31 temperatures.

Please choose from the following:

  1. Display the max temperature

  2. Display the min temperature

  1. Display the mean temperature for the month

    1. Display the median temperature for the month

    1. Display the mode temperature for the month

    1. Load a new file

    1. Quit

Choice –> 3

The average temperature was: 25.6 degrees

Lab 6 Dynamic Arrays/Files Solution
$30.00 $24.00