CSC110 Assignment 2 solution

$29.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (7 votes)

 

  1. Write a program that converts a Fahrenheit temperature to the equivalent Celsius temperature. To convert Fahrenheit to Celsius, subtract 32 from the Fahrenheit temperature and multiply by 5/9.
  2. Write a program that converts a Celsius temperature to the equivalent Fahrenheit temperature. To convert Celsius to Fahrenheit, the multiply the Celsius temperature by 9/5 and plus 32.
  3. Write a program to convert time duration to the equivalent total number of seconds. For example 1 hour 28 minutes and 42 seconds is equivalent to 5322 seconds. Display it on the screen.
  4. Write a program that converts the number of seconds into the equivalent amount of time as a combination of hours, minutes, and seconds. For example, 9999 seconds is equivalent to 2 hours, 46 minutes and 39 seconds.
  5. To compute the sine of a double precision value use this method:

Math.sin( value )

The value is in radians (not degrees.) The cosine is computed using

Math.cos( value )

Again, value is in radians. Write a program that:

  • Computes the sine of 0.5236 radians and saves it in a variable.
  • Computes the cosine of 0.5236 radians and saves it in another variable.
  • Computes the square of each those two values (use the variables), adds the two squares, and saves the result (in a third variable.)
  • Writes out the three variables.

The output statement should be something like:

System.out.println(“sine: ” + sinx + ” cosine: ” + cosx + ” sum: ” + sum );