Rate this paper
  • Currently rating
  • 1
  • 2
  • 3
  • 4
  • 5
5.00 / 6
views 1413 | downloads 825
Paper Topic:

C# Programming in visual studio

Advanced Web Programming

Task 1 - Conversion

The objective of this program is to develop a graphical user interface that will convert the entered number which is in Fahrenheit to its equivalent value in Celsius . Aside from this , conversions like from Inches to Miles and Quartz to Cubic Feet is also included in the program . All screenshots are shown in the succeeding figures below

The development of a program which basically covers on various conversion types takes only a number of processes . The conversions involve are Fahrenheit to Celsius , Inches to Miles

and Quartz to Cubic Feet . For Fahrenheit to Celsius , a value in Fahrenheit is subtracted by 32 and multiplied by 5 /9 . For inches to miles , a number in inches is divided by 12 since there are 12 inches in 1 foot and the result is further divided by 5280 since there are 5280 feet in 1 mile . A number expressed in quartz is multiplied by 0 .25 since there are 0 .25 gallons in 1 quart . The result is further multiplied by 0 .13 since there are 0 .13 cubic feet in 1 gallon . These are the processes that work behind the OK button of the form . All these are implemented in the correct manner , thus , coming up with the expected output

The development of the program includes the utilization of the different tools in Visual Studio .Net . It takes only 2 hours to finish the working program . The design of the program involves the tools in ASP .Net such as labels , textboxes and command buttons as shown in the figures below

The working progress of the program is shown below

The next figure shows the code behind the graphical user interface

The program is coded using C ASP .NET . The program code is as follows

using System

using System .Data

using System .Configuration

using System .Web

using System .Web .Security

using System .Web .UI

using System .Web .UI .WebControls

using System .Web .UI .WebControls .WebParts

using System .Web .UI .HtmlControls

public partial class _Default : System .Web .UI .Page

protected void btnOk1_Click (object sender , EventArgs e

try /fahrentheit to celsius conversion /the value entered is converted from string to double

double f System .Convert .ToDouble (txtFah .Text

double c (f - 32 5 / 9

txtCel .Text System .Convert .ToString (c /inches to miles conversion /the value entered is converted from string to double

double i System .Convert .ToDouble (txtInches .Text

double m (i / 12 5280

txtMiles .Text System .Convert .ToString (m /quartz to cubic feet conversion /the value entered is converted from string to double

double q System .Convert .ToDouble (txtQuartz .Text

double cf q 0 .25 0 .13

txtCuFeet .Text System .Convert .ToString (cf

catch (Exception ex

protected void btnClear1_Click (object sender , EventArgs e

txtFah .Text /clears all the textboxes

txtCel .Text

txtInches .Text

txtMiles .Text

txtQuartz .Text

txtCuFeet .Text

The screen shot of the working program is shown below

The program shows that a user needs to enter a value in the TextField labeled 1 , 3 and...

13 pages
1958.0 KB
Free sing-up

Not the Essay You're looking for? Get a custom essay (only for $12.99)