Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this program you will be asking the user for a 4 digit number and then your program will output that number in expanded scientific

In this program you will be asking the user for a 4 digit number and then your program will output that number in expanded scientific notation using the format shown below.

Here is your input value in expanded scientific notation:

userInput = (thousDigit * 10e3) + (hundsDigit * 10e2) + (tensDigit * 10e1) + (onesDigit * 10e0)

As an example, if the user inputs 5629, then your program should output the notation:

5629 = (5 * 10e3) + (6 * 10e2) + (2 * 10e1) + (9 * 10e0)

In order to do this, there are a variety of ways you could accomplish this task. However, for purposes of this lab, I am your customer and I am dictating the steps that you should implement. The steps are below:

  1. Read in a 4 digit integer value from the user and save in a variable called userDigits
  2. Create four variables, one for each place value in the number, and save the DIGIT that is in that place value into the appropriate variable. i.e. save the hundreds place digit into the hundreds place variable.
  • So how do you get just the digit from a place value in the original number? Think about using modulus and division by the place value here. What algorithm can you come up with to separate and save each digit into its variable?
  1. Use the four variables and the original number to print the output equation as shown above. Be precise in what your output looks like. It should match the formatting above exactly.

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

Students also viewed these Databases questions