Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please read the instructions carefully and this needs to done in python(not anything else). this is also for introductory class so plase make sure to

please read the instructions carefully and this needs to done in python(not anything else). this is also for introductory class so plase make sure to use simpler codes and provide comments please. i have also provided what sample output is supposed to look like in the bottom. thank you! image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
This project is designed to give students practice with loops, characters, and arithmetic. Your program will take a hexadecimal or binary number string as an input and print out its decimal value. Specification The program will provide a looping menu that invites the user to choose from a menu of number string decoding options. It must provide options to convert hexadecimal and binary into decimal notation for full credit. Proper implementation of a binary to hexadecimal decoding may be added for extra credit: Decoding Menu 1. Decode hexadecimal 2. Decode binary 3. Convert binary to hexadecimal 4. Quit Please enter an option: 1 Based on the user's selection, the program should prompt the user for the appropriate input: Please enter the numeric string to convert: 0xbadfood and should display the result of the string decoding / encoding: Result: 195948557 It should then display the menu again. This should repeat until the program is terminated. This project must not make use of existing hexadecimal and/or binary conversion routines built into the Python language; instead, you must do the conversion using your knowledge of binary and hexadecimal numbering systems. It may be helpful to think of the ASCII values of hexadecimal numbers when working on this projectl Program Methods Your program must provide and use the following methods. Each method signature must be match and it must behave as described. Methods should not display anything on the screent def hex_char_decode(digit) Decodes a single hexadecimal digit and returns its value. def hex_string_decode(hex) Decodes an entire hexadecimal string and returns its value. def binary_string_decode(binary) Decodes a binary string and returns its value. def binary_to_hex(binary) Decodes a binary string, re-encodes it as hexadecimal, and returns the hexadecimal string. NOTE: It is common to display hexadecimal numbers with ' 0x as the prefix (e.g., the number FFFFFFFF is represented as 0xFFFFFFFF. Your program must be able to convert a hexadecimal string into number regardless of whether it is prefixed with ' 0x.' Additionally, it must handle the binary prefix 'Ob'. It is also common for hex numbers to be typed in lowercase (e g., Oxffffffff); your program must handle upper-and lower-case letters. Decoding Menu 1. Decode hexadecimal 2. Decode binary 3. Convert binary to hexadecimal 4. Quit Please enter an option: 1 Please enter the numeric string to convert: 0x4321 Resu7t: 17185 Decoding Menu 1. Decode hexadecimal 2. Decode binary 3. Convert binary to hexadecimal 4. Quit Please enter an option: 1 Please enter the numeric string to convert: fFfffffF Resu7t: 4294967295 1. Decode hexadecimal 2. Decode binary 3. Convert binary to hexadecimal 4. Quit Please enter an option: 2 Please enter the numeric string to convert: 1010 Result: 10 Decoding Menu 1. Decode hexadecimal 2. Decode binary 3. Convert binary to hexadecimal 4. Quit Please enter an option: 2 Please enter the numeric string to convert: 0b11111111 Result: 255

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

9. Explain the relationship between identity and communication.

Answered: 1 week ago

Question

a. How do you think these stereotypes developed?

Answered: 1 week ago

Question

a. How many different groups were represented?

Answered: 1 week ago