Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this programming project is to write a C++ program to perform a simple arithmetic operation based on user input that uses if-statements,

The purpose of this programming project is to write a C++ program to perform a simple arithmetic operation based on user input that uses if-statements, switch-statements, and loops.

You will prompt the user for and read in an integer between 0 and 25, inclusively. If the integer is not in range, you will display a meaningful message indicating it is either less than 0 or greater than 25, and then continually re-prompt the user to enter the integer again until the user enters a valid integer.

Once the user has entered a valid integer, you will then prompt the user for and read in a second integer between 15 and 30, inclusively. If this second integer is not in range, you will display a meaningful message indicating it is either less than 15 or greater than 30, and then continually re-prompt the user to enter the integer again until the user enters a valid integer.

Once both integers have been entered, you will prompt the user for and read in the arithmetic operation that the user wishes to perform as follows: addition (+), subtraction (), multiplication (*), division (/), or modulus (%). If the user enters an operation other than those listed, you will display a meaningful message indicating that the operation is invalid, and then exit the program (i.e., not perform the requested operation).

You will then perform the requested arithmetic operation as input by the user, showing the details of the operation (i.e., the actual operation being performed). Additionally, you will display a meaningful message indicating whether the result of the operation was negative, zero, or positive. Your code should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, course section, date, and brief description), comments for each variable, and commented blocks of code.

Example of OutPut

image text in transcribed

mat0299@faculty:/csce1030s ./a.out Computer Science and Engineering CSCE 1030Computer Science I I Student Name EUID euid@my.unt.eduI Enter an integer between 0 and 25, inclusively: -4 ERROR: The integer you entered (-4) is less than 0. Enter an integer between 0 and 25, inclusively: 40 ERROR: The integer you entered (40) is greater than 25 Enter an integer between 0 and 25, inclusively: 18 Now enter a second integer between -15 and 30, inclusively: -94 ERROR: The integer you entered (-94) is less than -15. Now enter a second integer between -15 and 30, inclusively: 52 ERROR: The integer you entered (52) is greater than 30 Now enter a second integer between -15 and 30, inclusively: 3 Enter the arithmetic peration (+, -, *, /, r %) y u ' d like to perform : - subtraction : 18 - _3 = 21 The result of the operation (21) is positive! mat0299@faculty:/csce1030s ./a.out

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

5 The mechanics of the circular flow model.

Answered: 1 week ago

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago

Question

To solve by the graphical methods 2x +3y = 9 9x - 8y = 10

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago