Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

intro to c++, so basic language is preferred. Your goal is to read in and calculate the ratio between two quantities. The catch is that

image text in transcribed

intro to c++, so basic language is preferred.

Your goal is to read in and calculate the ratio between two quantities. The catch is that your program has to handle any category of object. For example the user might want to first track shoes and laces, then the next time they run the program track mountains and climbers, or some other pair of random objects. Two sample runs are shown below, where the user input is shown in yellow. (You don't have to change the color for your program.) Note the first column adjusts to the length of the words. How many in the first category? 4 shoes ow many in the second category? 8 laces shoes laces hoe-to-lace ratio 0.50 2.00 Press any key to continue ow many in the firet category? 2 mountains ow many in the eecond category? 23 climbers 23 0.09 11.50 Press any key to oontinue... Formatting: Your output should be formatted in 2 columns, as shown above. Note that the input words may be arbitrarily long and your formatting for the first column should adjust accordingly. You may assume all numbers are short enough so that a column width of 10 for the sccond column is sufficient. The ratios should be reported with cxactly 2 decimal places. You may assume all the input numbers are positive whole numbers Labels: The categories should be labelled in the first two output rows. The second two rows should show the ratios between the quantities. The labels for the ratios should involve singular nouns "mountain-to-climber ratio" not "mountains-to- climbers ratio"). You may assume that the input words are plural nouns and that the pluralization involves only adding "s" to the end of the singular noun. So we could have input words such as "things" and 'dragons", but not "fcet" or 'glasses You may assume each object category is a single word. Reminder Just before the rturn0; statement write the pause command: system(pause") Upload to CCLE source file hw2xpp with exactly this name (all lowercase, no spaces) Your project should demonstrate the following: Correctness: No errors, calculations correct .Handlesinput output correctly, formats output, precision as specified, column widths adjust to length of words . Correctly manipulates all strings (Removes s etc.) .Code is efficient but easy to follow Style: Variable names, comments, indentation

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

Logidata+ Deductive Databases With Complex Objects Lncs 701

Authors: Paolo Atzeni

1st Edition

354056974X, 978-3540569749

Students also viewed these Databases questions

Question

__________ are a basic application of our values.

Answered: 1 week ago

Question

3. Identify challenges to good listening and their remedies

Answered: 1 week ago

Question

4. Identify ethical factors in the listening process

Answered: 1 week ago