Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help completing this assignment in c++. this is the assignment how do i complete number 2? printing an error message and exit? thank

I need help completing this assignment in c++. this is the assignment how do i complete number 2? printing an error message and exit? thank you! image text in transcribed
In this assignment, you will create a very particular calculator that works with 3 integer numbers at a time rather than the usual 2 in regular calculators. The calculator is also particular in that the desired operation is provided ahead of the numbers: 1. So, first, ask the user to enter the desired operation (use cin) and store the value in a variable named operation. The user input will consist of a single letter or symbol. Entering: a) 'a' or 'A' gives the average (shown as a fractional number) b) 'M' gives the largest number c) 'c' or 'C' gives the middle number d) 'o' or 'O' gives the count of how many of the three numbers are even e) 'p' or 'P' tests whether any of the 3 numbers is divisible by 2, 3 and 5 f) 'e' or 'E' tests whether all of the 3 numbers are different B) 's', 'S' or '+'tests whether the sum of any 2 numbers adds to the 3rd one h) 'm' gives the sum of all numbers between the first and second number with a step increment given by the third number (see example below). 2. For example, entering 'a' or 'A' will get us the average. However, if the user input does not match any of the operations above, then the program must print an error message and exit. 3. If the operation is valid, then ask the user to enter three numbers. The numbers may be positive, negative, or zero. Expect them to be integers. If any input has decimals, your program will truncate the number. 4. Execute the requested operation and display the result(s). In all cases, the output is/are integers except for the average, which must be shown with 1 decimal. Also, for any program execution, only one of the operations indicated above needs to be executed. 5. Your program must include comments explaining the logical steps. Also follow a proper code formatting (both the comments and formatting are part of the evaluation rubric, which you can see in BB). See 2.24 Style guidelines" and " Programming Style to follow" under "Web Links on the left menu bar for additional reference

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions