Question: Java Program First Program: 1) You've been hired by Snow Superstars to write a Java console application that calculates and shows the total and average
Java Program
First Program:
1) You've been hired by Snow Superstars to write a Java console application that calculates and shows the total and average snowfall for three winter months. Configure the application in your development tool to receive the following three program arguments:
Integer snowfall for month 1 in inches.
Integer snowfall for month 2 in inches.
Integer snowfall for month 3 in inches.
Loop through the arguments array and print the index and value of each argument. Convert each argument from string to integer using Integer.parseInt(args[n]) and calculate the total and average snowfall. Format the total and average snowfall in two columns using escape sequences. The first column is a label and the second column is a value with units. The output should look like this:
Welcome to Snow Superstars
--------------------------
Index Argument
0 2
1 6
2 5
Total: 13 inch(es)
Average: 4.333333333333333 inch(es)
End of Snow Superstars.
Second Program:
2)
You've been hired by Spherical Stunts to write a Java console application that prompts for and reads a radius from the user, and calculates the following values:
- Volume of Sphere: V=(4/3)Pi*r^3
- Circumference of a sphere: C= 2PI*r
- Surface area of a sphere: A= 4PI*R^2
Use Math.PI for . Show the radius, volume, circumference, and surface area. Format the output in three columns with a label in the first column, a value in the second column, and the units in the third column. Use method printf to format the output. Declare constants for the formal specifiers. Format all real numbers to three decimal places. The output should look like this:
Welcome to Spherical Stunts
---------------------------
Enter the radius in cm: 4
Radius: 4.000 cm
Volume: 268.083 cm^3
Circumference: 25.133 cm
Surface area: 201.062 cm^2
End of Spherical Stunts.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
