Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You have been assigned to write a software to convert between decimal and binary number. The software should fulfill the following criteria: i. Receive either
You have been assigned to write a software to convert between decimal and binary number. The software should fulfill the following criteria: i. Receive either decimal or binary number and leave 0 for the other. Exit program if both input are 0 and print out error message if both input are non-zero. ii. A function called dec_to_bin() to convert decimal number to binary and function called bin_to_dec () to convert binary number to decimal. An example of the output is as illustrated in Figure Q3: Enter decimal or binary and leave 0 for the other, both o to exit. Enter decimal:14 Enter binary: 0 14 in decimal = 1110 in binary. Enter decimal or binary and leave 0 for the other, both o to exit. Enter decimal: 0 Enter binary:1010 1010 in binary 10 in decimal. Enter decimal or binary and leave 0 for the other, both 0 to exit. Enter decimal:1 Enter binary: 1 Please enter either decimal or binary. Enter decimal or binary and leave O for the other, both o to exit. Enter decimal: 0 Enter binary: 0 . Program finished with exit code 0 R. Based on the following requirement, you have to: (a) Identify input variable(s) and output variable(s) for this problem. [2 marks] (b) Draw the flowchart for the program. [9 marks] (c) Write the complete program. [14 marks]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started