Answered step by step
Verified Expert Solution
Question
1 Approved Answer
EGR 104 Practice Practicum 1 Name: Ocean Salinity Guidelines: 1. Put your name at the top of this document and return it at the
EGR 104 Practice Practicum 1 Name: Ocean Salinity Guidelines: 1. Put your name at the top of this document and return it at the end of the exam. 2. Materials provided for reference: ASCII Table, Order of Operations, printf reference, math.h and string.h function lists 3. You are allowed to use your textbook and notes for the exam. This includes submitted homework, labs, and in class assignments. You may not use any other electronic reference material. 4. With about ~10 minutes remaining, you must wrap up what you are doing, and upload your source code to the Blackboard Assignment Manager. 5. Take a deep breath - you can do it! Problem & Instructions: The salinity of the water in the ocean is a function of the water temperature, ocean depth and current speed. Additionally, the salinity is highly dependent upon the particular ocean that is under consideration. Your task today will be to write a program that will serve as an ocean salinity calculator. Given the water temperature T in degrees Kelvin, ocean depth D in meters and current speed C in meters per second, the water salinity S in parts-per-hundred (pph) is given as log 10 10(+D+1)T/223.1 166 S = 33 C+1 + 3.0 where R is the reference salinity for a particular body of water (i.e., a particular ocean). Your task today is to create a program to compute S in pph. You are to query the user to enter the water temperature T in degrees Celsius (you will need to convert 7 temporarily to degrees Kelvin to compute S), ocean depth D in meters and current speed C in meters per second. Assume that the user enters the data correctly and in the correct unit. Furthermore, you are to have the user enter the name of the ocean and a single letter (N or S) to indicate the hemisphere. Follow these detailed instructions: Tier 1 Requirements (Minimum Deliverables to receive a 'C' on the exam): 1. Pay attention to the compiler messages as you go along. Also turn it in on time. Penalties are as follows: Each type of error Each type of warning Each minute late -10 -5 -10 2. (15 pts) Start from the provided template code. Include any additional libraries that are necessary. Use good formatting and style. Match your output to the examples given. 3. (15 pts) Include the usual comment block, including the program name, author, date, class, professor, description, and notes. Include descriptive comments throughout. 4. (10 pts) Prompt user and scan in values for temperature (in Celsius), depth, and speed. (Prompts not shown; use your best judgment.) 5. (10 pts) Print the first line of the output using a custom function. 6. (10 pts) Display the requested output for temperature, depth, and speed. Your output statement must display as shown in the examples. 7. (10 pts) Convert the temp from C to K using a custom function and output as shown. = Temp(K) Temp (C) + 273.15 EGR 104 Practice Practicum 1 Tier 2 Requirements (Minimum Deliverables to receive a 'B' on the exam): 8. (5 pts) Prompt (best judgment) user and scan in the ocean name. 9. (5 pts) Prompt (best judgment) user and scan in the hemisphere (N/S). 10. (5 pts) Print out the hemisphere and ocean name as shown. Tier 3 Requirements (Minimum Deliverables to receive an 'A' on the exam): 11. (5 pts) Create a function to calculate the salinity using the given equation. 12. (5 pts) Use the function to calculate the salinity. 13. (5 pts) Display the salinity and output as shown. EGR 104 Test set #3: Input: Practice Practicum 1 31.5 2.75 12.9875 Pacific N Output: Based on the following data: temperature of 31.5 degrees C (304.65 K), depth of 2.75 m, and current speed of 12.9875 m/s in the N Pacific Ocean, the water salinity is 4.579 parts-per-hundred. Example Input/Output: Below are example test cases with expected output in order to help you validate your code. The input data is listed as T, D, C followed by the ocean name and hemisphere. Overview: Based on the following data: temperature of Starter Code: #include #include // Function prototypes void printFirstLine (void); double convert Ctok (double Celsius); double calcSalinity (double T, double D, double C); degrees C K), Tier 1 depth of m, and current speed of in the m/s Ocean, Tier 2 the water salinity is parts-per-hundred. Tier 3 int main() { Test set #1: double tempC; double tempK; double depth; // Temp in Celcius // Temp in Kelvin // Depth (m) Input: -2.3 411 2.1 Arctic N Output: Based on the following data: temperature of -2.3 degrees C (270.85 K), depth of 411 m, and current speed of 2.1 m/s in the N Arctic Ocean, the water salinity is 13.307 parts-per-hundred. Test set #2: Input: 22.787 1000 0.1224 Indian S Output: Based on the following data: temperature of 22.787 degrees C (295.937 K), depth of 1000 m, and current speed of .1224 m/s in the S Indian Ocean, the water salinity is 20.267 parts-per-hundred. -2- double current; // Current Speed (m/s) double salinity; // Salinity (pph) char ocean [10]; // Ocean name char hemisphere; // Single character for hemisphere (N/S) // Additional variables may be created, but the variables above // must all be used for the indicated purposes. return 0; } -3-
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started