In JAVA.There are two parts to this program. First part: Need to send specificat
ID: 3770921 • Letter: I
Question
In JAVA.There are two parts to this program. First part: Need to send specifications to the manufacturing plant. Need to know: Radius of the tank, Height of the cone, Height of the cylinder, and Type of steel to be used. Second part: Customer needs to know the following- Total weight of tank, Gallons the tank will hold, and Cost of the tank. Constants : We have determine through testing that 20 degrees is the optimal angle measure for the tanks we are manufacturing... need to declare 20 degrees as a global constant need to declare as a global constant. Input: Name of company tank is being built ( string ) Radius of tank to be built ( int ) Height of tank to be built ( int ) Convert the 20 degrees to radian measure... Use radian measure in all calculations. Equations needed: CONE (top) area of cone, volume of cone, CYLINDER ( tank ) Area of tank, cylinder Volume, tank cylinder CIRCLE (bottom) Area of bottom. To Know: If total gallons are less than or equal to 9000 use ½ in steel If total gallons are greater than 9000 and less than or equal to 20,000 use ¾ in steel If total gallons are greater than 20,0000 and less than or equal to 50,000 use 1 in steel If total gallons exceeds 20,000 use 2 in steel Weight is ft² Volume is ft³ Weights: ½ inch = 20.42 lb/ft², ¾ inch = 30.63 lb/ft², 1 inch = 40.84 lb/ft², 2 inch = 81.68 lb/ft² 1 ft³ = ? gallons cost = $1.98 lb / ft² (hint: need to find the total weight)//take this figure times the total weight. Don’t round any data during the processing. Output for customer: Company name, Total weight of tank, Gallons the tank will hold, and Cost of the tank //Format output data to two decimal places. Output for Manufacturing: Radius of the tank, Height of the cone, and Height of the cylinder.
Explanation / Answer
import java.io.*;
import java.util.*;
class main{
public static double degree = 20.0;
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.print("Enter the Name of the Company: ");
String name = sc.nextLine();
System.out.print("Enter the Radius of tank to be built: ");
int radius = Integer.parseInt(sc.nextLine());
System.out.print("Enter the Height of tank to be built: ");
int height = Integer.parseInt(sc.nextLine());
double rad = degree*Math.PI/180.0;
// Total Gallons Required (volume of cone + volume of Cylinder)
double vol = 0.33 * Math.PI*radius*radius*height + (Math.PI*radius*radius*height);
// 1 gallon = 3.785 litre
vol /= 3.785;
double weight;
if (vol < 900)
weight = 20.42;
else if (vol > 9000 && vol < 20000)
weight = 30.63;
else if (vol > 20000 && vol < 50000)
weight = 40.84;
else
weight = 81.68;
double cost = weight*1.98;
// For Customer
System.out.println("Company Name is "+name);
System.out.println("Total weight is "+weight);
System.out.println("Total volume is "+vol);
System.out.println("Total cost is "+cost);
// For Manufacturing
System.out.println("Total radius is "+radius);
System.out.println("Total Height is "+height);
System.out.println("Total Height is "+height);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.