Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ELET 2300 Assignment 2 Submit your program through Blackboard - No late submissions! Make sure that you upload the right C++ source file !!! In

image text in transcribedimage text in transcribed

ELET 2300 Assignment 2 Submit your program through Blackboard - No late submissions! Make sure that you upload the right C++ source file !!! 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 8) 's', 'S' or 't' 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. Example: Let's say that the user decides to enter the numbers 10 51 30. The output for each of the operations shown above should be (one program run will show only one of them of course): a) The average is 30.33 b) The largest number is 51 c) The middle number if 30 d) There are 2 even numbers e) At least one of the numbers (30) is divisible by 2,3 and 5 f) All of the numbers are different g) No two numbers add to the third one h) 50 Note that the last case (h) gives 50 because it is the sum of 10 + 40 (so the first number, plus 40: the first number + the step of 30). The sum ends here because the next number to be considered (ie, 10 + 30 + 30 = 70) is beyond 51. Another example, if the user enters 1 5 1, the result will be 15i.e, 1+2+3+4+5. given that the desired step increment now is 1). You will need to implement a C++loop to solve this part. Important observations: You must use only the C++ instructions that we have covered in the couse so far The program that you turn in must be your original and individual work. While you are allowed to discuss the program assignments in general terms with others, you are not allowed to share details of the actual solution(s) or program code with anybody except the instructor Turning in a copy of someone else's program, even a copy with extensive changes made to it, or receiving any unauthorized assistance is a very serious offense in this course. An automated plagiarism checker will scan programs at any time during the semester. Only submit your source code (.cpp). This must be done on or before the due date through Blackboard. No late submissions. Blackboard will automatically close the submission page right after the deadline. Your program must include comments explaining your steps and must be properly formatted (see Program Style_Guidelines.pdf in Blackboard). Insert the following block at the top of your file with your information: . + ELET 2300 Programming Assignment * ELET 2300 Assignment 2 Submit your program through Blackboard - No late submissions! Make sure that you upload the right C++ source file !!! 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 8) 's', 'S' or 't' 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. Example: Let's say that the user decides to enter the numbers 10 51 30. The output for each of the operations shown above should be (one program run will show only one of them of course): a) The average is 30.33 b) The largest number is 51 c) The middle number if 30 d) There are 2 even numbers e) At least one of the numbers (30) is divisible by 2,3 and 5 f) All of the numbers are different g) No two numbers add to the third one h) 50 Note that the last case (h) gives 50 because it is the sum of 10 + 40 (so the first number, plus 40: the first number + the step of 30). The sum ends here because the next number to be considered (ie, 10 + 30 + 30 = 70) is beyond 51. Another example, if the user enters 1 5 1, the result will be 15i.e, 1+2+3+4+5. given that the desired step increment now is 1). You will need to implement a C++loop to solve this part. Important observations: You must use only the C++ instructions that we have covered in the couse so far The program that you turn in must be your original and individual work. While you are allowed to discuss the program assignments in general terms with others, you are not allowed to share details of the actual solution(s) or program code with anybody except the instructor Turning in a copy of someone else's program, even a copy with extensive changes made to it, or receiving any unauthorized assistance is a very serious offense in this course. An automated plagiarism checker will scan programs at any time during the semester. Only submit your source code (.cpp). This must be done on or before the due date through Blackboard. No late submissions. Blackboard will automatically close the submission page right after the deadline. Your program must include comments explaining your steps and must be properly formatted (see Program Style_Guidelines.pdf in Blackboard). Insert the following block at the top of your file with your information: . + ELET 2300 Programming Assignment *

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

What are some of the costs and benefits of home ownership?

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