Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

@ Q 73%- 10:35 AM October 10 10:32 PM Sprint LTE Programming Projects183 reads the user's answer and then executes an if-ee stasement. Each of

image text in transcribed
@ Q 73%- 10:35 AM October 10 10:32 PM Sprint LTE Programming Projects183 reads the user's answer and then executes an if-ee stasement. Each of the st-eise statement will be a function call. The two functions called in the st-else statement will have function definitions that are very similar to the programs for the previous two programming projects. Thus, chey will be fairly complicated function definitions that call other fanctions in their function bodies. Include a loop thac lets the user repeat chis computation for new input values until the user says he or she wants to end the peogram 10. (You should do Programming Projeces 4.6 and 49 before doing this peogram ming project.) Write a program that combines the functions of Programming Projects 4.6 and 4.9. The program asks the user if lengths or weights. If the user chooses lengths, then the program asks the user if he or she wants to convert froen foet and inches so meters and centimeters or from meters and centimesers to feet and inches. If the user chooses weights, a similar quesion about pounds, ounces, kilograms, and grams is asked. The progeam them performs the desired conversion. Have the user respond by cyping the inieger for one type of conversion and 2 for the ocher. The peogram reads the user's answer and then executes an st-else statement. Each branch of the it-else statemen he or she wants so convert will be a funcrion call. The rwo functions called in the it-eise stasement will have function definitions that are very similar to the programs for Programming Projects 4.6 and 4.9. Thas, these functions will be fairly complicated function definitions that call other functions; however, they will be very casy to wrise by adapting the programs you wrote for Programming Projects 4.6 and 4.9. Notice that your program will have it-else statements embedded inside of it-ele seatements, bat only in an indirect way. The outer st-eloe statement will in- clude two function calls, as its two branches. These two function calls will each in turn include an if-else statement, but you need not think about that. They are just function calls and the details are in a black box that you create when you define these functions. If you try to create a four-way branch, you are p though the entire program does ultimately beanch ineo four cases). Include a loop that lets the user repeat this computation for new input values uncil the user says he or she wants to end the peogram. 0 11. You are a contestant on a game show and have won a shot at the grand priae Before you are three doors. $1,000,000 in cash has randomly been placed behind one door. Behind the ocher two doors are the consolation prizes of ergent. The game show host asks you to select a door, and you randoemly pick one However, beore nevealing the peize behind your door, the game show host reveals one of the other doors that contains a consolation prize. At this show host asks if you would like to stick with your original choice oe to swich to the remaining door. Project &.11 Ar this poimt, the game Write a function to simulate the game show problem. Your function should randomly select locations for the prines, select a door at random chosen by the contesant and then determine whether the contestant would win or lose by sticking wich Add to Library @ Q 73%- 10:35 AM October 10 10:32 PM Sprint LTE Programming Projects183 reads the user's answer and then executes an if-ee stasement. Each of the st-eise statement will be a function call. The two functions called in the st-else statement will have function definitions that are very similar to the programs for the previous two programming projects. Thus, chey will be fairly complicated function definitions that call other fanctions in their function bodies. Include a loop thac lets the user repeat chis computation for new input values until the user says he or she wants to end the peogram 10. (You should do Programming Projeces 4.6 and 49 before doing this peogram ming project.) Write a program that combines the functions of Programming Projects 4.6 and 4.9. The program asks the user if lengths or weights. If the user chooses lengths, then the program asks the user if he or she wants to convert froen foet and inches so meters and centimeters or from meters and centimesers to feet and inches. If the user chooses weights, a similar quesion about pounds, ounces, kilograms, and grams is asked. The progeam them performs the desired conversion. Have the user respond by cyping the inieger for one type of conversion and 2 for the ocher. The peogram reads the user's answer and then executes an st-else statement. Each branch of the it-else statemen he or she wants so convert will be a funcrion call. The rwo functions called in the it-eise stasement will have function definitions that are very similar to the programs for Programming Projects 4.6 and 4.9. Thas, these functions will be fairly complicated function definitions that call other functions; however, they will be very casy to wrise by adapting the programs you wrote for Programming Projects 4.6 and 4.9. Notice that your program will have it-else statements embedded inside of it-ele seatements, bat only in an indirect way. The outer st-eloe statement will in- clude two function calls, as its two branches. These two function calls will each in turn include an if-else statement, but you need not think about that. They are just function calls and the details are in a black box that you create when you define these functions. If you try to create a four-way branch, you are p though the entire program does ultimately beanch ineo four cases). Include a loop that lets the user repeat this computation for new input values uncil the user says he or she wants to end the peogram. 0 11. You are a contestant on a game show and have won a shot at the grand priae Before you are three doors. $1,000,000 in cash has randomly been placed behind one door. Behind the ocher two doors are the consolation prizes of ergent. The game show host asks you to select a door, and you randoemly pick one However, beore nevealing the peize behind your door, the game show host reveals one of the other doors that contains a consolation prize. At this show host asks if you would like to stick with your original choice oe to swich to the remaining door. Project &.11 Ar this poimt, the game Write a function to simulate the game show problem. Your function should randomly select locations for the prines, select a door at random chosen by the contesant and then determine whether the contestant would win or lose by sticking wich Add to Library

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago