Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Visual Basic program. Zip your files. Submit the program before the 5:0

ID: 3599989 • Letter: C

Question

Create a Visual Basic program. Zip your files. Submit the program before the 5:00 deadline.

Use a loop to calculate and display miles from 1 to 30 and the equivalent kilometers. Display the output in a RichTextBox. Include a heading in your output. Use the flowchart below as a guideline.

Name your project using your initials and the number of the program.

Include a prologue and comment your code.

create and code the Buttons

include a working Exit Button

include a working Convert Button

use a For...Next loop

include a report header

format and display the calculations

use Courier New font

comment your code

include a prologue at the top of the code

properly name all controls

properly name all variables

submit the all required files

10

Be sure to:

create and code the Buttons

include a working Exit Button

include a working Convert Button

use a For...Next loop

include a report header

format and display the calculations

use Courier New font

comment your code

include a prologue at the top of the code

properly name all controls

properly name all variables

submit the all required files

Scoring correctly displays the output 1 includes a report header 1 correctly calculates the kilometers 2 uses For...Next loop 2 working Buttons 2 comments and prologue 1 properly named controls and variables 1 Total

10

Start For i= 1 To 30 True 1.609344 False Display End Display

Explanation / Answer

Note: this code is in Asp.Net c#

1.Operation.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CrudOperation.aspx.cs" Inherits="SampleWebApp.CrudOperation" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 495px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
  
<table class="auto-style1">
<tr>
<td class="auto-style2">Process to calculate and display miles from 1 to 30 and the equivalent kilometers</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="Button2" runat="server" Text="Exit Button" />
</td>
<td>
<asp:Button ID="Button3" runat="server" Text="Convert Button" />
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
  
</div>
</form>
</body>
</html>

2. c# Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SampleWebApp
{
public partial class CrudOperation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Exit_Click(object sender, EventArgs e)
{
Response.Redirect("Home.aspx");
}

protected void ConvertBtn_Click(object sender, EventArgs e)
{
decimal distance;
decimal hour, min, sec;

decimal timeSec;
decimal mps;
decimal kph, mph;


distance = Convert.ToDecimal(Disttxt.Text);
hour = Convert.ToDecimal(hrtxt.Text);
min = Convert.ToDecimal(mintxt.Text);
sec = Convert.ToDecimal(sextxt.Text);

timeSec = (hour * 3600) + (min * 60) + sec;
mps = distance / timeSec;
kph = (distance / 1000.0f) / (timeSec / 3600.0f);
mph = kph / 1.609f;

label1.Text="Your speed in meters/sec is {0}"+ mps + "Your speed in km/h is {0}"+kph+ "Your speed in miles/h is {0}"+ mph;
for(int i=1;i<=30;i++)
{
decimal k = mph + 1.609344;
label2.Text = "i is" + i;
label3.Text = "K is" + k;
}
}

}
}