/*======== Fall 2024 - CS 111 Week 9 Lab Exercise date: 2024-10-25 ========*/ /*--- USING pair-programming * COPY and PASTE the contents of this file into a lab9.cpp file within the CS50 IDE * ADD the parts asked for below (one student saying what to type, the other student typing it into the CS50 IDE) * each time you want to compile: in a CS50 terminal that is open to the folder CONTAINING this .cpp file, ("Open in Integrated Terminal"), type: g++ lab9.cpp -o lab9 * IF it compiles with no errors: to run: in that same CS50 terminal that is open to the folder CONTAINING this .cpp file, type: ./lab9 * When you are satisfied with its output, create an example output file by typing: ./lab9 > lab9-out.txt * Download copies of your resulting lab9.cpp and lab9-out.cpp by right-clicking on their names in the file explorer on the left of the CS50 IDE, and use Gmail to MAIL a copy of these files to BOTH of you. * And, EACH of you should SUBMIT these TWO files lab9.cpp and lab9-out.txt to Canvas ---*/ /*--- by: PUT BOTH of YOUR NAMES HERE last modified: 2024-10-25 ---*/ #include <cstdlib> #include <iostream> #include <string> #include <cmath> using namespace std; /*--- WEEK 9 LAB EXERCISE - PROBLEM 1 - function box_volume ---*/ /*--- In Week 9 Lectures 1 and 2, we used the design recipe to design and write a C++ function circ_area. Use the design recipe to design and write a C++ function box_volume that expects a rectangular box's length and width and height and returns its volume. * include its test bool expressions in a comment AFTER the purpose statement, AND copy each into a cout in the main function at the bottom to actually run each test expression and see its result * (IF you want: you can also include one or more cout statements that JUST include an example call of box_volume AFTER these tests, so you can SEE the value those call(s) return) ---*/ /*--- signature: purpose: tests: ---*/ /*--- WEEK 9 LAB EXERCISE - PROBLEM 2 - function cool_enough ---*/ /*--- Use the design recipe to design and write a C++ function cool_enough that expects a temperature in Fahrenheit and returns if it is less than 70 degrees Fahrenheit (true if it is, false if not) * include its test bool expressions in comment AFTER the purpose statement, AND copy each into a cout in the main function at the bottom to actually run each test expression and see its result * be careful -- at least how many tests are needed for this function? * (IF you want: you can also include one or more cout statements that JUST include an example call of cool_enough AFTER these tests, so you can SEE the value those call(s) return) ---*/ /*--- signature: purpose: tests: ---*/ /*--- test the functions above ---*/ int main() { cout << boolalpha; cout << "*** Testing: box_volume ***" << endl; // copy each of box_volume's test bool expressions into a // cout statement to print its result // (then REMOVE the // comment parts so you can RUN that cout!) // cout << () << endl; // cout << () << endl; cout << "*** Testing: cool_enough ***" << endl; // copy each of cool_enough's test bool expressions into a // cout statement to print its result // (then REMOVE the // comment parts so you can RUN that cout!) // cout << () << endl; // cout << () << endl; // cout << () << endl; return EXIT_SUCCESS; }