Question: Use c# In Class Activity: Using Methods You will modify the Fuel Economy program to have the method check for various data validations. The current

Use c#  Use c# In Class Activity: Using Methods You will modify the
Fuel Economy program to have the method check for various data validations.
The current calculateButton_Click method is doing more than 1 task and also

In Class Activity: Using Methods You will modify the Fuel Economy program to have the method check for various data validations. The current calculateButton_Click method is doing more than 1 task and also is not using methods that can be reused by other methods. .Step 1: Expand the data validation in calculateButton Click . Change the calculateButton Click to include input validation that checks for 1 Empty text, 2. Invalid text, 3. Negative numbers for both the textboxes. And proceed with the mpg calculation only if the input is valid for both the boxes. define a variable called gooddata and initialize it to true. Go through three checks for miles TextBox that validate all the three conditions above Go through three checks for milesTextBox that validate all the three conditions above Your program will have the following outlie //declare local variables int miles ; int gallons e; int mpg; bool goodData true; // DATA VALIDATION for milesTextBox /Idata validation for non-empty miles, if not valid /I display correct error message for milesTextBox, and set gooddatas false /Idata validation for valid integer for miles, if not valid gooddata- false /I display correct error message for milesTextBox, and set gooddata- false /Idata validation for positive value for miles, if not valid gooddata- false /I display correct error message for milesTextBox, and set gooddatas false // DATA VALIDATION for gallonsTextBox /Idata validation for non-empty gallons, if not valid /I display correct error message for gallons TextBox, and set gooddata- false //data validation for valid integer for gallons, if not valid gooddata- false /I display correct error message for gallons TextBox, and set gooddata- false /Idata validation for positive value for gallons,if not valid gooddata- false /I display correct error message for gallonsTextBox, and set gooddata- false if (gooddata) //Proceed with mpg calculation and update the label

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!