Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm sorry but I'm having trouble doing this assignment Integer Division if you can help me I will appreciate. Integer Division PREPARATION Finish reading chapter

I'm sorry but I'm having trouble doing this assignment Integer Division if you can help me I will appreciate.

Integer Division PREPARATION Finish reading chapter 2, 3.1, and 3.2 (through multi-way if-else , p.126)

Review up through Week4 of Class Notes (pay attention to C++ integer division, modulus operator %, and multi-way or nested if-else)

GOALS Reinforce your ability to access and operate within the *NIX environment

Practice compilation with arguments

Practice algorithm creation and pseudocode comments

Practice translating pseudocode to C++ code

Practice testing skills using file redirection & output display tools

Create, implement, test, and submit a C++ program that performs the TASK specified in the ACTIVITY below

Practice using the following C++ concepts & constructs:

o include directives, variable declarations, assignment, standard input and output,

NEW: Accessing the quotient & remainder separately, using integer division and the modulus operator. Example:

quotient = numerator / denominator;

remainder = numerator % denominator; ACTIVITY ALGORITHM CREATION:

Review the specifications for the TASK specified below, and create an algorithm to solve the problem. What will be the program input(s)? What will be the program output(s)? How will your program calculate the expected outputs? This should all be clearly addressed by your algorithm. Your algorithm should be identifiable from your pseudo-code/comments. TASK: You will write a program that will apply integer division to two integer values and display the quotient and the remainder. It will safely handle division by zero. Your program should include the introduction, prompts, labeling, and spacing precisely as indicated in the example below:

THIS PROGRAM DIVIDES TWO INTEGERS.

Please enter the value for the numerator: 15

Please enter the value for the denominator: 4 15/4 = 3 R3 NOTES on SPACING:

A blank line appears before and after the introduction (RED CAPS)

A blank line appears before and after the calculated output (blue)

A blank space appears before and after the "=" sign, and before the "R". If there is no remainder, no space nor 'R' will be printed. In the event that the user enters a 0 for the denominator, your output should simply be: CANNOT DIVIDE BY ZERO! COMPILATION & TESTING: g++ -std=c++11 lab5.cpp -o lab5

See sample test cases, and create your own. You should test on multiple combinations of inputs, to your own handworked examples. Pay close attention to spacing when comparing to my sample outputs. Test INTERACTIVELY, as well as with diff -y.

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

Students also viewed these Databases questions