Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions