EECS 1510 Project 2 Elementary Aspects of Java solution

$30.00

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

Description

5/5 - (4 votes)

a. Modulo Division Write a program to read in a 3­digit integer and print out the sum of the digits of
the integer. Use the % operator to extrct the digits and use the / operator to extract the digit. Use the
following format for input/output:
Enter an integer: 744
The sum of the digits is: 15
b. Approximating Pi Pi can be computed using the formula
4 * (1.0 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11 + 1/13 – . . .)
Write a program to display the result of
4 * (1.0 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11 + 1/13)
Note: be sure to use 1.0 not 1 in your program.
c. Wind Chill The National Weather Service has a relatively new formula to measure the wind chill
temperature. The formula is
Wind Chill = 35.74 + 0.6215T – 35.75V0.16 + 0.4275TV0.16
where T = outside temperature (°F) and V = wind velocity (mph). The formula cannot be used for
wind speeds below 2 mph, temperatures below -58°F, or temperatures above 41°F.
Write a program that prompts the user to enter a temperature and a wind speed, and then displays the
wind chill temperature. You may assume the values entered are valid.
Enter temperature(Fahrenheit): 5.3
Enter wind speed(mph): 6
The wind chill index is -5
d. Distance Given the two points (x1, y1) and (x2, y2), the distance between these points is given
by the formula:

Write a program that prompts the user to enter the two points, and then displays the distance between
them. You may assume the values entered are valid. For example,
Enter x1 and y1: 1.0 5
Enter x2 and y2: -2.0 1
The distance is 5.0