Question

In: Computer Science

Develop a form to display centigrade temperature and corresponding Fahrenheit temperature ranging from 30 to 90...

Develop a form to display centigrade temperature and corresponding Fahrenheit temperature ranging from 30 to 90 at increments of 10. Use a do while loop. Please use the below formula to convert Celsius to Fahrenheit in advance C#

I need the form not a table. Thank you!

Solutions

Expert Solution

C Sharp Program:

File: Form1.Designer.cs

namespace TemperatureForm
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lstBoxTemperature = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lstBoxTemperature
//
this.lstBoxTemperature.FormattingEnabled = true;
this.lstBoxTemperature.Location = new System.Drawing.Point(51, 58);
this.lstBoxTemperature.Name = "lstBoxTemperature";
this.lstBoxTemperature.Size = new System.Drawing.Size(188, 199);
this.lstBoxTemperature.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(48, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(191, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Celsius to Fahrenheit Conversion Table";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 276);
this.Controls.Add(this.label1);
this.Controls.Add(this.lstBoxTemperature);
this.Name = "Form1";
this.Text = "Celsius to Fahrenheit";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.ListBox lstBoxTemperature;
private System.Windows.Forms.Label label1;
}
}

_________________________________________________________________________________________

File: Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TemperatureForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

//Form load event handler
private void Form1_Load(object sender, EventArgs e)
{
//Variables
double tempC=30, tempF;

//Writing headers in listbox
lstBoxTemperature.Items.Add("Celsius \t Fahrenheit");

//Looping over temperatures from 30 to 90 at increments of 10
do
{
//Converting temperature
tempF = (tempC * 1.8) + 32;

//Adding a row
lstBoxTemperature.Items.Add(tempC.ToString("0.00") + "\t" + tempF.ToString("0.00"));

//Incrementing tempC
tempC = tempC + 10;

} while (tempC <= 90);
}
}
}
__________________________________________________________________________________________

Sample Run:


Related Solutions

Develop a routine to convert Celcius to Fahrenheit. Have a form pass the values and a...
Develop a routine to convert Celcius to Fahrenheit. Have a form pass the values and a parm indicating what time of conversion is taking place. Use a function (if possible). Return the correct value. Here is the formula: C = (F - 32) * 5/9 hw8.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title></head> <body> <p>Convert Temp</p> <form id="form1" name="form1" method="get" action="hw8.php"> <table width="300" border="1"> <tr> <td width="122">Enter Temp </td>...
Write a function in bash that takes an input temperature (Celsius or Fahrenheit) from the user...
Write a function in bash that takes an input temperature (Celsius or Fahrenheit) from the user converts that temperature Celsius to Fahrenheit, Fahrenheit to Celsius, Celsius to Kelvin and Fahrenheit to Kelvin
****USING BASH**** Write a function that takes an input temperature (Celsius or Fahrenheit) from the user...
****USING BASH**** Write a function that takes an input temperature (Celsius or Fahrenheit) from the user converts that temperature Celsius to Fahrenheit, Fahrenheit to Celsius, Celsius to Kelvin and Fahrenheit to Kelvin.
Write a program read in data from the standard input stream (cin) representing temperature in Fahrenheit....
Write a program read in data from the standard input stream (cin) representing temperature in Fahrenheit. The program will then convert the values into Kelvin (using 5/9 (Fº-32) to convert to Celsius and a difference of 273.15 between Celsius and Kelvin) and print out the new total value. Convert temperature in Fahrenheit to Kelvin : Enter temperature in Fahrenheit: 80.33 The temperature in Kelvin is: 300 Write a second program which then does the reverse conversion (using a difference of...
Develop several concept sketches for a common product. Try designing the product form both “from the inside out” and “from the outside in.”
Product Design and Development (6th Edition) Develop several concept sketches for a common product. Try designing the product form both “from the inside out” and “from the outside in.” Which is easier for you? Possible simple products include a stapler, a garlic press, an alarm clock, a reading light, and a telephone
A greenhouse (30’x20’x10’) in Yuma, Arizona needs to be cooled from an outside temperature of 110oF...
A greenhouse (30’x20’x10’) in Yuma, Arizona needs to be cooled from an outside temperature of 110oF to an indoor 75oF. The RH outside is 4% and the greenhouse requires 5 air changes per hour. Determine the amount of water required per hour to achieve this level of Evaporative cooling. Please state your answer in pounds of water. State ALL assumptions, Show all work for full Credit
Part 1: A pot is made of 500 g steel with specific heat of 0.10 cal/(g °C). How much heat is needed to raise its temperature from 30 °C to 100 °C?
  Part 1: A pot is made of 500 g steel with specific heat of 0.10 cal/(g °C). How much heat is needed to raise its temperature from 30 °C to 100 °C? Part 2: If we add 500 g of water into the pot above, how much heat is needed to raise the temperature of the pot of water from 30 °C to 100 °C? 2. A balloon shrinked to 90% of its orginal size after it was taken...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT