Question
This is C# and is due tonight so please help. A text box for the user to enter the integer to convert This is referred
This is C# and is due tonight so please help.
A text box for the user to enter the integer to convert
This is referred to as the 'Convert From' textbox
A text box for the user to enter the base to which the number will be converted
This is referred to as the 'Base' textbox
A label to display the resulting converted number
This is referred to as the 'Message' label
Set this label off by having it be a pleasing shade of a color like blue or green or yellow
This label will also serve as your display for ANY error messages the user needs to see
Each Text Box or Label is to have some caption that tells the user what the text box or label is for
Place a label near the text box to inform the user what goes into the text box
A clear button to clear out all values from the text boxes and the label
A convert button to perform the conversion with a given base
This is to be known as the 'Convert To' button and be labeled as such
A series of specific convert buttons
One button is to say 'Binary'
One button is to say 'Hex'
One button is to say 'Octal'
One button is to say 'Base 5'
One button is to say 'Base 7'
An Exit button to close the program
All convert buttons should be the same size, color, font face, font size, etc.
The Exit and Clear buttons should be the same size, color, font face, font size, etc. and those should be different from those of the convert buttons
All textbox text and label text should be of a reasonable size and easy to read font face.
Operation
The user enters an integer value and then clicks one of the convert buttons.
The 'Convert From' textbox contents will be converted into the base.
If a specific base button is used such as octal, then no entry in the 'Base' textbox is required.
If the Convert To button is used, then the 'Base' textbox will need to be utilized in the convert process.
The escape key should exit the program and be tied to the Exit Button using form properties only.
All errors should be handled without dropping into the IDE.
There are error cases that need to handled and possibly prevented by the use of validation
Specifications
The application should accept integer values as entries like 3 or 48.
These are to be input into the 'Convert From' textbox for the number to convert
Bases should be accepted from the range of 2 to 16, other base conversions should be treated as an error with appropriate error messages to the user.
This also means that negative bases will not be acceptable either and need validation against them
DO NOT Assume that the user will enter valid data for the integer value. Entering a number such as 12.4 for either the 'Convert From' textbox or the 'Base' textbox is an error and should be handled.
Decimal values for numbers to be converted from or the base are errors
Negative values for either of the two numbers should also be considered errors
Numbers for the base outside the range given should be considered errors
There may be others that you find along the way that you need to watch for also
The program must work using methods to do the conversions instead of having the repeated code inside of the button click events
Your overall conversion should be a single method. There may be step methods you have to call along the way but one method should be used to convert from an integer number to a base and then be called from various parts of the application
Minimize the use of class scope variables, aka Global Variable , use parameter passing for methods either by value or by reference
Pull the numbers from the text boxes into variables in the click events and then pass those numbers to the validation methods and then finally to the convert method
You can have the method that converts return information or pass information back and forth by using reference parameters
If you have to use a class scope variable, there must be comments justifying the use
The user experience should include the activation and deactivation (enabled property of controls such as buttons) of the buttons.
The Clear and Exit buttons will always be active. There is not need to turn these on and off.
The Convert To button (the one the uses the 'Convert From' textbox and the 'Base' textbox to do the conversion) should only be active when the two textboxes both have content. Utilizing the textchanged event on each textbox will be helpful on this requirement.
The Specific Conversion buttons should be active when the 'Convert From' textbox has content. Look again at the textchanged event.
All controls should have meaningful names. This means to not use textbox1 or button1 but name them something meaningful for their operation such as ExitButton or ClearButton.
The user experience should include meaningful error messages to the user with minimal disruption to their entering of data. Use the results label to display error messages to the user instead of popping up a message box.
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