Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Each of these rules should be applied to the second array in the next step. Example: - - - - - - - - -

Each of these rules should be applied to the second array in the next step.
Example:
-------------
|1|0|0|
-------------
|0|0|1|
-------------
|1|1|1|
-------------
It is converted to the following table after 1st step:
-------------
|0|0|0|
-------------
|1|0|1|
-------------
|0|1|1|
-------------
Therefore, your program should take the number of steps in the beginning, and should show the
content of your second array after each step. In the end, your program should print the decimal value
of each row by using dashes (-) at the end of final step.
Example Run 1:
Welcome to our program.
Enter a string: 5-2-7
Enter a number of steps: 3
-------------
|1|0|1|
-------------
|0|1|0|
-------------
|1|1|1|
-------------
It is converted to the following table after 1st step:
-------------
|0|1|0|
-------------
|0|0|0|
-------------
|1|1|1|
-------------
It is converted to the following table after 2nd step:
-------------
|0|0|0|
-------------
|1|0|1|
-------------
|0|1|0|
-------------
It is converted to the following table after 3 rd step:
-------------
|0|0|0|
-------------
|0|1|0|
-------------
|0|1|0|
-------------
The decimal value for the second table after 3 steps: 0-2-2.
Example Run 2:
Welcome to our program.
Enter a string: 5-2-16
The number 16 cannot be represented with 3x3 array!
Enter a string: 10-5-15-0
Enter a number of steps: 2
-----------------
|1|0|1|0|
-----------------
|0|1|0|1|
-----------------
|1|1|1|1|
-----------------
|0|0|0|0|
-----------------
It is converted to the following table after 1st step:
-----------------
|0|1|1|0|
-----------------
|0|0|0|1|
-----------------
|1|1|0|1|
-----------------
|0|1|1|0|
-----------------
It is converted to the following table after 2nd step:
-----------------
|0|0|1|0|
-----------------
|1|0|0|1|
-----------------
|1|1|0|1|
-----------------
|1|1|1|0|
-----------------
The decimal value for the second table after 2 steps: 2-9-13-14.

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions