Question: Overview This lab is designed to give you practice with loops, characters, and arithmetic. Your program will take a hexadecimal or binary number string as
Overview
This lab is designed to give you 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. PLEASE MAKE SURE THAT I CAN COPY AND PAYSTE THE CODE. Also don't use int
Submission Instructions
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 and binary to hexadecimal for full credit.
Decoding Menu
Decode hexadecimal
Decode binary
Convert binary to hexadecimal
Quit
Please enter an option:
Based on the users selection, the program should prompt the user for the appropriate input:
Please enter the numeric string to convert: xbadfd
and should display the result of the string decoding encoding:
Result:
It should then display the menu again. This should repeat until the program is terminated.
This project must not make use of existing hexadecimal andor 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 project!
Program Methods
Your program must provide and use the following methods. Each method signature must be matched and it must behave as described. Methods should not display anything on the screen!
def hexchardecodedigit
Decodes a single hexadecimal digit and returns its value.
def hexstringdecodehex
Decodes an entire hexadecimal string and returns its value.
def binarystringdecodebinary
Decodes a binary string and returns its value.
def binarytohexbinary
Decodes a binary string, reencodes it as hexadecimal, and returns the hexadecimal string.
NOTE: It is common to display hexadecimal numbers with x as the prefix eg the number FFFFFFFF is represented as xFFFFFFFF Your program must be able to convert a hexadecimal string into a number regardless of whether it is prefixed with x Additionally, it must handle the binary prefix b It is also common for hex numbers to be typed in lowercase egxffffffff; your program
must handle upper and lowercase letters.
Sample Submission Output
Decoding Menu
Decode hexadecimal
Decode binary
Convert binary to hexadecimal
Quit
Please enter an option:
Please enter the numeric string to convert: x
Result:
Decoding Menu
Decode hexadecimal
Decode binary
Convert binary to hexadecimal
Quit
Please enter an option:
Please enter the numeric string to convert: fFfFfFfF
Result:
Decoding Menu
Decode hexadecimal
Decode binary
Convert binary to hexadecimal
Quit
Please enter an option:
Please enter the numeric string to convert:
Result:
Decoding Menu
Decode hexadecimal
Decode binary
Convert binary to hexadecimal
Quit
Please enter an option:
Please enter the numeric string to convert: b
Result:
Decoding Menu
Decode hexadecimal
Decode binary
Convert binary to hexadecimal
Quit
Please enter an option:
Please enter the numeric string to convert:
Result: F
Decoding Menu
Decode hexadecimal
Decode binary
Convert binary to hexadecimal
Quit
Please enter an option:
Goodbye!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
