Drop hier links of afbeeldingen om ze aan de editor toe te voegen.

Input Centigrade and output Fahrenheit.

★☆☆

Fahrenheit was once the main scale used in England and is still widely used in America, although the founding fathers thought about adopting the metric system instead. Around 1965, Britain began switching towards the metric system.

Temperature converter

Make

Write a program that converts between Centigrade and Fahrenheit.

Success Criteria

Remember to add a comment before a subprogram to explain its purpose.

Complete the subprogram called c_to_f so that:

  1. It returns the Fahrenheit calculated as Centigrade multiplied by 1.8 plus 32.

Complete the main program so that:

  1. The first line of Main should print the prompt and read the Centigrade value as an integer.
  2. The next line should call the c_to_f subprogram.

Typical inputs and outputs from the program would be:

Enter the temperature in Centigrade:
30
30 degrees Centigrade is 86.0 degrees Fahrenheit.
🆘 If you're really stuck, use this Parsons code sorting exercise
Complete program
// Temperature converter program

using System;

class Submission
{
---
    // -------------------------
    // Subprograms
    // -------------------------
    // Convert Centigrade to Fahrenheit
---
    static double c_to_f(int centigrade)
    {
---
        return (centigrade * 1.8) + 32;
---
    }
---

    // -------------------------
    // Main program
    // -------------------------
    public static void Main(string[] args)
    {
---
        Console.WriteLine("Enter the temperature in Centigrade:");
        int centigrade = Convert.ToInt32(Console.ReadLine());
---
        double fahrenheit = c_to_f(centigrade);
---
        Console.WriteLine(centigrade + " degrees Centigrade is " + fahrenheit + " degrees Fahrenheit.");
---
    }
---
}