Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hints for Exercise 3 2 the optional algoithm below displays a user decimal integer rput vaa 3 moving left to-right Since t uses integer division

image text in transcribed
Hints for Exercise 3 2 the optional algoithm below displays a user decimal integer rput vaa 3 moving left to-right Since t uses integer division (both standard and 2 Exclude any exsing souce code fies that may akeady be in your iDE projecs and 3 naming &CLAJE3, main cpp wite a program in that fe to convet an artstrary uner 4 integes value ireo wordh based sokly upon its mumenc value, nor older complers d either operand is negative (Note 2.8). the inpul vaue necesary there are no meted loops, part A s completed before par B begin, and pan Bs 6 expected words word minus part C begins Only one instance of the code for each part s necessary AL. Prompt the user, get ha/her inpu, and ouuput the dhplay message up to the point where the A2 If the uner input value s negative change it to postive and dsplay the word "minusfolowed must be frit Hne fest word of the value s Part 8("'for" loop is used) Find a power of 10 divisc that wil produce the mox ignificant digt IMSDI of the postive rou 81. Assign 1 to a divisor vaniable and the pontive nout vakue to a dvidend variable 82 If the value of the dividend is greater than 9 17 Your program must a. Muliply the divsor by 10 the product becomes the new divisor b. Divide the dividend by 10, the quocent becomes the new dividend c. Repeat from step 82 port the use to enter any decinal integ" value une cin >> 10Mead the ertie volrat oncerto a type varate. deplaty the variable's value and the equvaient words in the tormat below, placing double quctes around both for readability For example & the use inp s 2 Ehe Proceed to Part C below 64se the folowing would get deplayed in words is "einus two six four five zero" Part Cdo loop s used) The staroing value for the divsor used in this part wwi be the value computed for t in Part B above. Part C will pick off the digits or the postive input value eft to right and diplay them as 4. not use atry non cornt variabies that are 5 003 use anything involving floating point types the pow funcion, math.h type double anays or recunion, recurion occus when a function h called before a previours cal to CI, Asign the poutre nut value to a doerd aute has setumed, for example. when a function callh hen 2c 30 Manualy re-tun your program several times tesing with at as th tolowing 6input values oot use any neted loops-they are botaly unnecesary C2 Diidle the dividend by the divbor, which yields the MSD. Display it as a word uing Ca Mutiply the MSD by the dvsor and reduce the dvidend's value by that amount (hes C4 10 case swtch statement bee belowl. 3 123 1010 -1010 0002000 emoves the dividend's MSD 1 Div de the d nor by 10: the resbecomes the new dnor "the new chio sot equal too.repeathorn step C2. Else You are finished displaying the number in wonds C5. 4 Submiting your solution 35 Send your source code Sie to 6 9-character UCSD student ID 3 See the couse document ted Prepaning and Submiming Your Assignments' for addtional esercise 38 formaming submission, and Assignment Checker sequremenn the Asormet Checker with the ord he CIAn0whne Ovs.ya. While the use of magic numbers"s ssualy a bad idea, in some such as for the cases" used in the switch statement" rec each case represents & unique numerc va meaning to these values other than the values unmstakable, there is no possibility that they might ever need to be changed, and there & no themeves, ther purpose s obvious and would make ther meaning any cleares Thus, the Reral values should be stuations they are appropnate ommended for this exencse. Specrically lue ranging fom o theough 9. Thee s no undertying 41 Hns Detaled hints are on the next page dencfier Iname) that pectied directly, as follows switch (-) case 1: 1992-2018 Ray Mtchel 992 2018 Ray Mtchel Page 2 of 2 of CIA3E3

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

=+Why were they effective? How could you continue the campaign?

Answered: 1 week ago

Question

1. Where will you recommend that she hold the focus group?

Answered: 1 week ago

Question

3. What might you have done differently

Answered: 1 week ago