Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Go through this drill step by step. Do not try to speed up by skipping steps. Test each step by entering at least three pairs

image text in transcribed
Go through this drill step by step. Do not try to speed up by skipping steps. Test each step by entering at least three pairs of values - more values would be better. 1. Write a program that consists of a while-loop that (each time around the loop) reads in two ints and then prints them. Exit the program when terminating | is entered. 2. Change the program to write out the smaller value is: followed by the smaller of the numbers and the larger value is: followed by the large value. 3. Augment the program so that it writes the line the numbers are equal (only) if they are equal. 4. Change the program so that it uses doubles instead of ints. 5. Change the program so that it writes out the numbers are almost equal after writing out which is die larger and the smaller if the two numbers differ by less than 1.0/100. 6. Now change the body of the loop so that it reads just one double each time around. Define two variables to keep track of which is the smallest and which is the largest value you have seen so far. Each time through the loop write out the value entered. If its the smallest so far, write the smallest so far after the number. If it is the largest so far, write the largest so far after the number. 7. Add a unit to each double entered;that is, enter values such as 10cm, 2.5in, 5ft, or 3.33m. Accept the four units: cm, m, in, ft. Assume conversion factors 1m = = 100cm, 1in == 2.54cm, 1ft == 12in. Read the unit indicator into a string. You may consider 12 m (with a space between the number and the unit) equivalent to 12m (without a space). 8. Reject values without units or with "illegal" representations of units, such as y, yard, meter, km, and gallons. 9. Keep track of the sum of values entered (as well as the smallest and the largest) and the number of values entered. When die loop ends, print the smallest, the largest, die number of values, and the sum of values. Note that to keep the sum, you have to decide on a unit to use for that sum;use meters. 10. Keep all the values entered (converted into meters) in a vector. At the end, write out those values. 11. Before writing out the values from the vector, sort them (thatll make them come out in increasing order)

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 Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

2. How is communication defi ned?

Answered: 1 week ago

Question

How will the members be held accountable?

Answered: 1 week ago

Question

a. Do team members trust each other?

Answered: 1 week ago