Answered step by step
Verified Expert Solution
Question
1 Approved Answer
asks user to enter speed of a vehicle (in miles per hour) and the number of hours it has traveled It should then use a
asks user to enter speed of a vehicle (in miles per hour) and the number of hours it has traveled It should then use a loop to display the cumulated distance the vehicle has traveled every hour in that time period. | Distance Calculator 60 Speed Hours our Distance 60 120 180 240 300 2 Create a new windows form application called DistanceCalculator. Add controls to the form and set the properties for each control. For the result text box, make it a multiline box by checking the MultiLine from the smart tag menu. 1. 2. Distance Calculator Speed Hours TextBox Tasks MultiLine Double click the Calculate button from the designer to create an event handler method, write code in the code view to perform the following tasks: 3. a. Read input speed and hours from the text boxes b. Display the header of the output in the multiline text box using the code below: textBox1.Text - "Hour" + "\t" + "Distance" + " "; + -concatenate string literals " represents a Tab space rin"reresent a new line 4. Use a for loop statement to calculate the distance for each hour repeatedly and display each hour and the corresponding distance in the text box below the header. Follow the above code to format the hour and distance in two columns as shown below. You may use "+ " to append each new line of result message: txtResult. Text Double click the Exit button to create an event handler method to close this form. Save and test the application using the following testing data, results should be displayed with correct value and formats 5. 6. Distance Calculator x Speed Hours Hour Distance 120 180 240 300 Exit Distance Calculator 45.5 Speed Hours Hour Distance 91 136.5 182 227.5 DistanccCalculator Microsoft Visual Studio t- Quick Launch (Ctrl+0 File Edit View Project Build Debug Team Format ToolsTest Analyzc Window Help Sign in DebugAny CPU Start- Formlcs Distance Calculator sing System.Collections Generic using System.ConmponentModcl; using Systom.Data; using System.Drawing; using Systom.Linq; using Systom.Text using Systom.Thrcading.Tasks; using Systom.Windous. Farns Form1 18 11 nanespace DistanceCalculator Hours public parlisl class Foeni:Forn 13 14 15 16 17 public Forn1) InitializeComponent() Caculetc 28 private void btnCalculate Click(object sendar, LventArgs c) decinal Speed Convert. ToDecimal(txtspeed.Text); decimal TotalDi stance = 0; 23 2.4 26 27 28 29 100%
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