Question

1. Loop termination by user-query method – flowchart Throughout the world, engineers have built locks that...

1. Loop termination by user-query method – flowchart

Throughout the world, engineers have built locks that help boats to navigate between rivers and canals that are at different levels. For boats to travel through the lock, water is added or removed from the lock to raise or lower the water level.

Draw a flowchart that keeps track of the water level for a series of water adjustments. Use a loop to repeatedly ask the user to enter water adjustment amounts. Within the loop, accumulate the current water level. If the requested adjustment value would cause the lock’s water level to become negative (which is impossible), set the water level to 0. If the requested adjustment value would cause the lock to become empty, print a warning message. Below the loop, print the water level. Assume that all water values are in feet. Study the sample session below, so you know the required format for your flowchart’s prompts, inputs, and final output.

Sample session:

What is the lock's water level in feet? 100

Enter water adjustment: 20

Do you want to continue? (y/n): y

Enter water adjustment: -70

Do you want to continue? (y/n): y

Enter water adjustment: -70

Warning! The lock is now empty!

Do you want to continue? (y/n): y

Enter water adjustment: 30

Do you want to continue? (y/n): n

The lock's water level is 30 feet.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here iam providing the flowchart for the given problem

if you any doubts please comment

Add a comment
Know the answer?
Add Answer to:
1. Loop termination by user-query method – flowchart Throughout the world, engineers have built locks that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C code 1. Write and submit the algorithm OR flowchart to indicate you understand the...

    In C code 1. Write and submit the algorithm OR flowchart to indicate you understand the problem 2. Create a project and name the source code lastname_firstname_prog5.c 3. Use the prog5.c as a guide, copy/ paste into your project source code *** build run and test, the outline code - You will need to declare an integer variable called again and initialize it 4. Add the function prototype and implement the function definition for the Greeting function 5. Add the...

  • Having trouble with the do while/while loop and the switch statement. I got some of the...

    Having trouble with the do while/while loop and the switch statement. I got some of the switch statement but cant get the program to repeat itself like it should.What i have so far for my code is below. Any help is appreciated... i am not sure what I am doing wrong or what i am missing. I am completely lost on the while loop and where and how to use it in this scenario. import java.util.Scanner; public class sampleforchegg {...

  • C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) L...

    C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...

  • I have written my code for an employee management system that stores Employee class objects into...

    I have written my code for an employee management system that stores Employee class objects into a vector, I am getting no errors until I try and compile, I am getting the error: C2679 binary '==': no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion). But I am not sure why any help would be great, Thank you! 1 2 3 4 5 6 7 8 9 10 11 12 13...

  • In this project, you will write a complete program that allows the user to play a...

    In this project, you will write a complete program that allows the user to play a game of Mastermind against the computer. A Mastermind game has the following steps: 1. The codebreaker is prompted to enter two integers: the code length n, and the range of digits m. 2. The codemaker selects a code: a random sequence of n digits, each of which is in the range [0,m-1]. 3. The codebreaker is prompted to enter a guess, an n-digit sequence....

  • I want to get answers and short explan. 1. 50 year old female states she has...

    I want to get answers and short explan. 1. 50 year old female states she has “the worst headache of her life”. The onset was 20 minutes ago and it was abrupt. Vitals BP 180/90 P56 and R 20. You should suspect? Uncontrolled hypertension migraine headache TIA subarachnoid hemorrhage When lifting a stretcher into the ambulance using power grip, you should? position hands 10’ apart support weight on heels of palms 82 yo F mumbling and throwing clothes, nurse says...

  • This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation...

    This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation inside a class. Task One common limitation of programming languages is that the built-in types are limited to smaller finite ranges of storage. For instance, the built-in int type in C++ is 4 bytes in most systems today, allowing for about 4 billion different numbers. The regular int splits this range between positive and negative numbers, but even an unsigned int (assuming 4 bytes)...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

  • Rework this project to include a class. As explained in class, your project should have its...

    Rework this project to include a class. As explained in class, your project should have its functionalities moved to a class, and then create each course as an object to a class that inherits all the different functionalities of the class. You createclass function should be used as a constructor that takes in the name of the file containing the student list. (This way different objects are created with different class list files.) Here is the code I need you...

  • Question: 3. Compare the philanthropic activities of Soles 4 Souls and TOMS Shoes. Describe the differences...

    Question: 3. Compare the philanthropic activities of Soles 4 Souls and TOMS Shoes. Describe the differences and similarities of the two organizations. Which group appears to help more people, from a philanthropic view? Explain your reasoning. 4. Is giving really the driving force behind TOMS shoes, in your opinion? Explain. 5. How do you think TOMS’ model may change now that Bain Capital is its partner? 3 TOMS Shoes: Helping Soles All Over the World In 2002, Blake Mycoskie and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT