Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6812901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:30:21+00:00 2026-05-26T20:30:21+00:00

Hi i am suppose to make a Temperature calculator that will accept either Celsius

  • 0

Hi i am suppose to make a Temperature calculator that will accept either Celsius or perimeter and convert that temperature to the other scale. If a Celsius temperature is entered it will be converted to Fahrenheit and vice versa.

Instructions:

For this you will have to design and code a method to convert one temperature scale to another and return the result. This single method should take two arguments, one for the temperature value to convert and a second indicating which temperature scale to convert to.

Your method should be coded so that it could be accessed by another class or application. Also, make sure there is only one return statement in your method.

So far i have created this code but it showing me 2 small errors and i don’t know how to fix them.

**error 1. Constant value ’67’ cannot be converted to a ‘char’

error 2. Constant value ’70’ cannot be converted to a ‘char’**

namespace Lab7
{
public partial class frmTemperatureConverter : Form
{
public frmTemperatureConverter()
{
InitializeComponent();
}

    private void txtValueToConver_TextChanged(object sender, EventArgs e)
    {

    }

    private void btnConvert_Click(object sender, EventArgs e)
    {
        char chr;
        string str1;
        string str2;
        object[] objArray;
        if (this.txtConvert.Text != "")
        {
            double num1 = double.Parse(this.txtConvert.Text);
            if (this.radCelsius.Checked)
            {
                chr = 67;
                str1 = "farenheit";
                str2 = "celsius";
            }
            else
            {
                chr = 70;
                str1 = "celsius";
                str2 = "farenheit";
            }
            double num2 = Math.Round(this.ConvertTemperature(num1, chr), 2);
            this.lblResult.Text = string.Concat(new object[] { num1, " ", str1, " converts to ", num2, " ", str2 });
        }
        else
        {
            this.lblResult.Text = "Please enter a numeric temperature to convert.";
            this.txtConvert.Focus();
        }
    }

    public double ConvertTemperature(double inTemp, char toScale)
    {
        double num;
        if (toScale == 70)
        {
            num = inTemp * 1.80 + 32.00;
        }
        else
        {
            if (toScale == 67)
            {
                num = (inTemp - 32.00) / 1.80;
            }
            else
            {
                num = inTemp;
            }
        }
        return num;
    }

    private void btnClear_Click(object sender, EventArgs e)
    {
        this.txtConvert.Text = "";
        this.lblResult.Text = "";
        this.txtConvert.Focus();
        this.radCelsius.Checked = true;
    }

    private void btnExit_Click(object sender, EventArgs e)
    {
        base.Close();
    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:30:22+00:00Added an answer on May 26, 2026 at 8:30 pm

    The problem is that 67 and 70 are not characters — they are integers.

    The simplest thing would to make the variable “chr” an integer. Then you should probably change its name too — perhaps to “toScale” — the same as the parameter name.

    Or you could leave the variable “chr” as a char, and use the values ‘C’ instead of 67 and ‘F’ instead of 70. This method makes it easier to understand the program, too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have an element called #container-main . How do I make that display:none
Suppose this is my URL route: (r'^test/?$','hello.life.views.test'), How do I make it so that
My program is suppose to make a GUI that calculates the square root of
Suppose I want to make a webpage that takes domain name of a website
I suppose the answer to this will be no, but I want to make
Suppose I have a class that I want to make sure my compiler (GCC
Suppose that I wanted to read an integer from cin and then make it
Suppose you want to make an async request in JavaScript, but you want to
Suppose I want to make a Web application which uses a fixed width and
Suppose the jQuery object of the input is $input. How to make its value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.