Question

Can someone help me out? c# For this Project, you will create a function called getTemperatures()....

Can someone help me out? c#

For this Project, you will create a function called getTemperatures(). The getTemperatures() function will have one parameter called temperatures[].Within the getTemperatures() function you will populate the temperatures array with the following values: 10,15,20,25,30,32,40,45,50,55,60,65,70. Your main program will traverse through the array and display the Fahrenheit and Celsius equivalents.

Expected output
10 degrees Fahrenheit is -12 degrees Celsius

10 degrees Celsius is 50 degrees Fahrenheit

15 degrees Fahrenheit is -9 degrees Celsius

15 degrees Celsius is 59 degrees Fahrenheit

20 degrees Fahrenheit is -6 degrees Celsius

20 degrees Celsius is 68 degrees Fahrenheit

25 degrees Fahrenheit is -3 degrees Celsius

25 degrees Celsius is 77 degrees Fahrenheit

30 degrees Fahrenheit is -1 degrees Celsius

30 degrees Celsius is 86 degrees Fahrenheit

35 degrees Fahrenheit is 1 degrees Celsius

35 degrees Celsius is 95 degrees Fahrenheit

40 degrees Fahrenheit is 4 degrees Celsius

40 degrees Celsius is 104 degrees Fahrenheit

45 degrees Fahrenheit is 7 degrees Celsius

45 degrees Celsius is 113 degrees Fahrenheit

50 degrees Fahrenheit is 10 degrees Celsius

50 degrees Celsius is 122 degrees Fahrenheit

55 degrees Fahrenheit is 12 degrees Celsius

55 degrees Celsius is 131 degrees Fahrenheit

60 degrees Fahrenheit is 15 degrees Celsius

60 degrees Celsius is 140 degrees Fahrenheit

65 degrees Fahrenheit is 18 degrees Celsius

65 degrees Celsius is 149 degrees Fahrenheit

70 degrees Fahrenheit is 21 degrees Celsius

70 degrees Celsius is 158 degrees Fahrenheit

0 0
Add a comment Improve this question Transcribed image text
Answer #1

using System;

class Program
{
  
static void Main()
{
int c, f;
int[] temperatures = new int[13] ;
getTemperatures(temperatures );
for(int i=0;i<temperatures.Length;i++) {
f = (9*temperatures[i])/5 + 32;
c = (temperatures[i]-32) * 5/9;
Console.WriteLine(temperatures[i]+" degrees Fahrenheit is "+c+" degrees Celsius");
Console.WriteLine(temperatures[i]+" degrees Celsius is "+f+" degrees Fahrenheit");
}
}
static void getTemperatures(int[] temperatures ) {

for(int j=0,i=10;i<=70;i+=5) {

temperatures[j++] = i;
}
}
}

Output:

10 degrees Fahrenheit is -12 degrees Celsius
10 degrees Celsius is 50 degrees Fahrenheit
15 degrees Fahrenheit is -9 degrees Celsius
15 degrees Celsius is 59 degrees Fahrenheit
20 degrees Fahrenheit is -6 degrees Celsius
20 degrees Celsius is 68 degrees Fahrenheit
25 degrees Fahrenheit is -3 degrees Celsius
25 degrees Celsius is 77 degrees Fahrenheit
30 degrees Fahrenheit is -1 degrees Celsius
30 degrees Celsius is 86 degrees Fahrenheit
35 degrees Fahrenheit is 1 degrees Celsius
35 degrees Celsius is 95 degrees Fahrenheit
40 degrees Fahrenheit is 4 degrees Celsius
40 degrees Celsius is 104 degrees Fahrenheit
45 degrees Fahrenheit is 7 degrees Celsius
45 degrees Celsius is 113 degrees Fahrenheit
50 degrees Fahrenheit is 10 degrees Celsius
50 degrees Celsius is 122 degrees Fahrenheit
55 degrees Fahrenheit is 12 degrees Celsius
55 degrees Celsius is 131 degrees Fahrenheit
60 degrees Fahrenheit is 15 degrees Celsius
60 degrees Celsius is 140 degrees Fahrenheit
65 degrees Fahrenheit is 18 degrees Celsius
65 degrees Celsius is 149 degrees Fahrenheit
70 degrees Fahrenheit is 21 degrees Celsius
70 degrees Celsius is 158 degrees Fahrenheit

Add a comment
Know the answer?
Add Answer to:
Can someone help me out? c# For this Project, you will create a function called getTemperatures()....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • NOTE: ALL C PROGRAMS MUST BE DONE IN UNIX SYSTEM WITH VI EDITOR 1. Write a...

    NOTE: ALL C PROGRAMS MUST BE DONE IN UNIX SYSTEM WITH VI EDITOR 1. Write a program that asks the user to enter a U.S. dollar amount and then shows how to pay that amount using the smallest number of $20, $10, $5 and $1 bills. Save the file as dollarAmountToNotesFirstinitialLastname.c Sample output: Enter a dollar amount: 93 $20 bills: 4 $10 bills: 1 $5 bills: 0 $1 bills: 3 Hint: Divide the amount by 20 to determine the number...

  • Can someone help me with this? Create a mini program including a main() method and void...

    Can someone help me with this? Create a mini program including a main() method and void methods where arrays are nxn i.e. same no. of rows & columns 1. displayArray(): Takes one parameter, a 2D symmetrical int array called "symmetric" & print the array as shown in the sample output. 2. shiftTheRowsBelow(): Takes one parameter, a 2D symmetrical int array called "symmetric". It will take the given values in the last row of the array, move them to the first...

  • Be able to give traversals of the entire tree: Pre-Order: 45, 25, 15, 10, 20, 35,...

    Be able to give traversals of the entire tree: Pre-Order: 45, 25, 15, 10, 20, 35, 30, 40, 65, 55, 50, 60, 75, 70, 80 (extra 45 removed). In-Order: 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80 Post-Order: 10, 20, 15, 30, 40, 35, 25, 50, 60, 55, 70, 80, 75, 65, 45

  • In this project you will create a console C++ program that will have the user to...

    In this project you will create a console C++ program that will have the user to enter Celsius temperature readings for anywhere between 1 and 365 days and store them in a dynamically allocated array, then display a report showing both the Celsius and Fahrenheit temperatures for each day entered. This program will require the use of pointers and dynamic memory allocation. Getting and Storing User Input: For this you will ask the user how many days’ worth of temperature...

  • This program will take the user's input as a temperature in degrees Fahrenheit. The user will...

    This program will take the user's input as a temperature in degrees Fahrenheit. The user will then click a radio button indicating whether a table of temperatures, starting with the entered value, will be displayed in increments of 5 degrees F or 10 degrees F. When a submit button is clicked your code will display a HTML table of temperature values. The first column will be temperatures in degrees Fahrenheit, given in increments of 5 or 10 degrees F, depending...

  • HELP ME PLEASE!!! Interested in knowing the prices of hamburgers in the city, a group of...

    HELP ME PLEASE!!! Interested in knowing the prices of hamburgers in the city, a group of descriptive statistics were asked, at what price do they buy hamburgers without combo and without being from a commercial chain? Below are the values that reflect the price 50 40 50 35 60 75 45 65 65 60 45 30 50 65 30 45 85 80 50 65 45 55 55 30 40 70 25 55 45 10 Calculate the mean and standard deviation...

  • 8. Following are the 'Handic spectra for two isomeric hromalkancs, A and B (compon following page) with molecular...

    8. Following are the 'Handic spectra for two isomeric hromalkancs, A and B (compon following page) with molecular formula C.H.Br. Draw their structure. (compound B is on the 1Η COCI (Solvent) www wwwwwwwwwwwwww 95 90 85 80 75 70 wwww 60 55 50 45 65 40 35 30 25 20 15 10 CDCI (Solvent) TMS 95 90 RS 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0 -5 -10

  • Exercise 4 – Printing out 10 multiples per row Design a function called print_ten_multiples that takes...

    Exercise 4 – Printing out 10 multiples per row Design a function called print_ten_multiples that takes an integer as a parameter. The function should print out the first 10 multiples of all numbers from 1 up to the given number. The values printed should be formatted with "3d". Example: print(format(x, "3d")) Examples of how the function output should look with this formatting: print_ten_multiples(3): 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14...

  • P $70 $65 $60 $55 $50 ATC $45 $40 $35 AVC MR $30 $25 $20 $15...

    P $70 $65 $60 $55 $50 ATC $45 $40 $35 AVC MR $30 $25 $20 $15 $10 $5 01234 56789 10 11 12 13 14 Based on the graph above, what is the profit maximizing price? o $45 $25 $5 S40 O $20 $10 $70 $50 S60 $65 S55 SI5 S30 $35

  • 100- Relative Intensity T 10 15 20 25 30 35 50 55 60 65 70 75...

    100- Relative Intensity T 10 15 20 25 30 35 50 55 60 65 70 75 40 45 m/z

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT