Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

User For this challenge, you will create a flowchart for the algorithm below. ( DO NOT USE ANOTHER ALOGORITHM ) . The algorithm is used

User
For this challenge, you will create a flowchart for the algorithm below. (DO NOT USE ANOTHER ALOGORITHM).
The algorithm is used as a way to convert octal values to decimal values.
Scenario:
1. Your program accepts as input a 4-digit octal number. Examples: 0137,4456,6167,0602
a. Each digit will be stored in a single char variable. This means you need to create 4 char variables.
2. To calculate your decimal equivalent, you will do the following:
a. Ask the user for a 4-digit octal number and save the digits to 4 variables eg. octval1, octval2, octval3, octval4
b. Store the value 512 into variable cube8.
c. Follow the below algorithm to convert the number to decimal.
, Step no. Operation Description
1 Ask for digits If the user enters q or Q; quit the program
2 octval1*= cube8 Multiply octval1 by cube8 and save the result to octval1
3 cube8>>=3 Shift right cube8 by 3 and save the result to cube8
4 octval2*= cube8 Multiply octval2 by cube8 and save the result to octval2
5 cube8>>=3 Shift right cube8 by 3 and save the result to cube8
6 octval3*= cube8 Multiply octval3 by cube8 and save the result to octval3
7 cube8>>=3 Shift right cube8 by 3 and save the result to cube8
8 octval4*= cube8 Multiply octval4 by cube8 and save the result to octval4
9 result = sum(octvalN) Add all octval values and store the result in the result
10 Start again at step 1 Loop back to the top, at step 1.
N in octvalN represents any number in the set (octval1, octval2, octval3, octval4)
IMPORTANT: When you enter your octal digits, you will enter each as a character.
Use the following symbols to complete the 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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions