Most metals weaken as temperature increases. For many metals, its Ultimate Tensi
ID: 3764533 • Letter: M
Question
Most metals weaken as temperature increases. For many metals, its Ultimate Tensile Strength (UTS) is defined by the following equation, where T is the current temperature and the Exponent is specific to the metal:
For example, a common type of Stainless Steel has an Exponent value of 2.0. For the temperature values [0, 100, 200, 300, 400, 500], the UTS of this type of stainless steel is [1.0, 0.99, 0.96, 0.91, 0.84, 0.75]. That means, for example, that at 500 degrees C, this type of stainless steel retains 75% of its original strength.
Write a function that takes 2 vectors, T and E --- temperatures and exponents --- and returns a matrix of UTS values for each combination of temperature and exponent. Example: suppose T = [0, 200, 400] and E = [2.0, 3.0], then the function returns
The rows denote each temperature [0, 200, 400] and the columns denote each exponent [2.0, 3.0]. [ Hint: you may need a loop to build the resulting matrix, either row by row or column by column. ]
Explanation / Answer
Answer:
import java.util.*;
class Temperature
{
public static void main(String args[])
{
temperaturecalculate();
}
static void temperaturecalculate()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter number of temperatures and exponents you want
to enter :");
int n= sc.nextInt();
Double temp[] = new Double[n];
Double exp[] = new Double[n];
for(int i=0;i<n;i++)
{
temp[i]=sc.nextDouble();
}
for(int i=0;i<n;i++)
{
exp[i]=sc.nextDouble();
}
double uts=0.0;
for(int i=0;i<n;i++)
{
double value=temp[i]/1000;
//System.out.println(value);
double expvalue=Math.pow(value,exp[i]);
//System.out.println(expvalue);
double uts=1-(expvalue);
System.out.println("The UTS values are given as"+uts);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.