A blizzard is a massive snowstorm. Definitions vary, but for our purposes, we will assume that a blizzard is characterized by winds of 30 mph or higher and blowing snow that leads to visibility of 0.5 miles or less, sustained for at least four hours. Create a file called stormtrack.dat. There should be 24 lines in the file, one for each hour of the day. Use the randi and rand functions to generate values for the wind speed and visibility at a location on each line such that the visibility values range from 0-5 miles and the wind speed ranges from 0-40mph. Read this data from the file and determine whether blizzard conditions were met during this day or not. If blizzard conditions exist at a particular hour, print a message that says "at XX winds were YY and visibility was ZZ'. After processing all 24 hours for a particular day, print a summary message that says either, "there was no blizzard today" or "there was a blizzard today".
A blizzard is a massive snowstorm. Definitions vary, but for our purposes, we will assume that a blizzard is characterized by winds of 30 mph or higher and blowing snow that leads to visibility of 0.5 miles or less, sustained for at least four hours. Create a file called stormtrack.dat. There should be 24 lines in the file, one for each hour of the day. Use the randi and rand functions to generate values for the wind speed and visibility at a location on each line such that the visibility values range from 0-5 miles and the wind speed ranges from 0-40mph. Read this data from the file and determine whether blizzard conditions were met during this day or not. If blizzard conditions exist at a particular hour, print a message that says "at XX winds were YY and visibility was ZZ'. After processing all 24 hours for a particular day, print a summary message that says either, "there was no blizzard today" or "there was a blizzard today".
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
5.25 matlab
Expert Solution
Algorithm
- Generate 24 hours of data for wind speed and visibility using randi function.
- Open the file stormtrack.dat for writing using fopen function.
- Write the generated data to the file using fprintf function.
- Close the file using fclose function.
- Open the file stormtrack.dat for reading using fopen function.
- Read the data from the file using textscan function.
- Close the file using fclose function.
- Initialize the blizzard flag to false.
- Loop through each hour of data and check if the wind speed is greater than or equal to 30 mph and visibility is less than or equal to 0.5 miles.
- If the blizzard conditions are met, set the blizzard flag to true and print a message.
- After looping through all hours, if the blizzard flag is true, print the message "There was a blizzard today." If the blizzard flag is false, print the message "There was no blizzard today."
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education