Starlings With a Sense In this quest, you get to play with branching statements. You will create 6 functions, each of wh

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Starlings With a Sense In this quest, you get to play with branching statements. You will create 6 functions, each of wh

Post by answerhappygod »

Starlings With A Sense In This Quest You Get To Play With Branching Statements You Will Create 6 Functions Each Of Wh 1
Starlings With A Sense In This Quest You Get To Play With Branching Statements You Will Create 6 Functions Each Of Wh 1 (40.45 KiB) Viewed 43 times
Starlings With A Sense In This Quest You Get To Play With Branching Statements You Will Create 6 Functions Each Of Wh 2
Starlings With A Sense In This Quest You Get To Play With Branching Statements You Will Create 6 Functions Each Of Wh 2 (37.13 KiB) Viewed 43 times
Starlings With A Sense In This Quest You Get To Play With Branching Statements You Will Create 6 Functions Each Of Wh 3
Starlings With A Sense In This Quest You Get To Play With Branching Statements You Will Create 6 Functions Each Of Wh 3 (26.96 KiB) Viewed 43 times
Starlings With A Sense In This Quest You Get To Play With Branching Statements You Will Create 6 Functions Each Of Wh 4
Starlings With A Sense In This Quest You Get To Play With Branching Statements You Will Create 6 Functions Each Of Wh 4 (72.87 KiB) Viewed 43 times
Starlings With a Sense In this quest, you get to play with branching statements. You will create 6 functions, each of which does something that requires making decisions. Each of these functions is worth varying numbers of points. It's up to you to find out how many points you can score by making the most progress you can. As usual, I will give you template code you can copy and flesh out. Your first miniquest - Mean of three To get past this checkpoint you must correctly implement the following function in the template code: double mean_of_3 (int n, int n2, int n3); When I invoke this method, I will supply it three integer parameters. It must return their average value to me as a double. Your second miniquest - Max of five You must implement: int max_of_5(int n, int n2, int n3, int n4, int n5); When I invoke this method, I will supply it five integer params. It must return the greatest of them to me.
Your third miniquest - Min of five You must implement: int min_of_5 (int n, int n2, int n3, int n4, int n5); When I invoke this method, I will supply it five integer params. It must return the least of them to me. Your fourth miniquest - Triangle from sides You must implement: bool sides_make_triangle (int a, int b, int c); Page 2 of 6 When I invoke this method, I will supply it three integer params. Return whether it is possible to form a triangle using the given numbers as side lengths. True means yes.
Your fifth miniquest Triangle from angles You must implement: . bool angles_make_triangle (int A, int B, int C); When I invoke this method, I will supply it three integer params. Return whether it is possible to form a triangle using the given numbers as angles in degrees. True means yes. Your sixth miniquest Leap Test You must implement: bool is a leap year (int year); When I invoke this method, I will supply it an integer parameter. Return whether the given number is a leap year or not (according to the definition you can find in Wikipedia). True means yes.
Testing your own code You should test your functions using your own main () function in which you try and call your functions in many different ways and cross-check their return value against your hand-computed results. But when you submit you must NOT submit your main. I will use my own and invoke your functions in many creative ways. Hopefully you've thought of all of them. Note When you define your functions in one file and invoke them from another, the compiler has no way of telling if the number and type of parameters with which you're invoking them are correct. It can't have your back. To help the compiler help you (yes, those who help others help them usually end up getting the most help), you can tell it in advance what the signatures of these functions you will use from elsewhere are. These function signatures are usually either: • put at the top of the cpp file in which you plan to invoke them or • collectively put within a header file that is then #included in the cpp source file In this quest, simply put the below declarations at the top of your main.cpp file (or anywhere else you intend to call your functions from). Starting with the next quest, you will put them in a separate header file (and thus need to upload it together with your cpp file at the testing site). // Forward declarations of functions that will be used in this file // before their definitions are encountered by the compiler double mean_of_3(int n, int n2, int n3): int max_of_5(int n, int n2, int n3, int n4, int n5); int min_of_5(int n, int n2, int n3, int n, int n5); bool sides_make_triangle (int a, int b, int c): bool angles_make_triangle (int A, int B, int C): bool is a leap year (int year);
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply