Thede pictures down you may need them to do the assignment. Computer Program Ass
ID: 3852845 • Letter: T
Question
Thede pictures down you may need them to do the assignment.Computer Program Assignments or each of the following problems, write a computer program using an appropriate programming language with which you are most famil- iar. Make the program user friendly by incorporating plenty of com- ments and input prompts so that the user will understand the input data to be entered and the limitations of their values. The output should include the data entered and the computed results, and they must be well labeled to identify each quantity. If a tabulated format is used, a proper heading must be included at the top of the table. Do not limit the program to any specific unit system. Indicate the consistent U.S. customary or SI units that can be used. C18-1 Write a computer program that can be used to calculate the stresses on the inclined plane m-m for the element in Fig. C18-1 subjected to a state of plane stress. The user input should include (1) the values of the stresses ' ' and and (2) the angle measured from the vertical to the incline. The output results are to be the normal stress and the shear stress t, on the incline. Follow the sign convention described in Section 18-6. Use this program to solve FIGURE C18-1 (a) Example 18-9, (b) Problem 18-29, (c) Problem 18-31, and (d) Problem 18-32 Ti 2 a,
Explanation / Answer
//Program written in Java language
import java.lang.Math.*;
import Java.io.*;
public class stressCalculator
{
public static void main(String args[])
{
InputStreamReader is = new InputStreamReader (System.in);
BufferedReader br = new BufferedReader (r);
/* Readvalueof normal stress acting on vertical plane normal along x axis*/
System.out.println("Enter value of normal stress along x axis");
String b = br.readline();
double nsx = Double.parseDouble(b);
/*reread value of normal stress along y axis*/
System.out.println("Enter the value of stressalong y axis");
String b= br.readLine();
Double nsy = Double.parseDouble(b);
/*read value of the shear stress along x axis*/
System.out.println("read value of shear stress along x axis");
String b = br.readLine();
Double ssx= Double.parseDouble(b);
//Read the value of angle measured from vertical to incline
System.out.println("read the value of angle measured from vertical to incline");
String b = br.readLine();
Double angle= Double.parseDouble(b);
Double normalStressIncline = normalStressCalculate(nsx,nsy,ssx,angle);
System.out.println(" The value of normal stress along incline is %f ", normalStressIncline);
Double shearStressIncline = shearStressCalculate(nsx,nsy,ssx,angle);
System.out.println(" The value of shear stress along incline is %f ", shearStressIncline);
} //End of main method
// Method returns the value of normal stress along incline
public double normalStressCalculate (double nsx,double nsy, double ssx, double angle)
{
double normalStress ;
normalStress= ((nsx+nsy)/2) + ((nsx-nsy)/2)* Math.cos(2*angle) + ssx * Math.sin(2*angle);
return normalStress;
}// End of method
// Method to calculate and return shear stress along incline public double shearStressCalculate (double nsx, double nsy, double ssx, double angle)
{
double shearStress;
shearStress= ((nsx - nsy)/2) * Math.sin(2*angle) + ssx * Math.cos(2*angle);
return shearStress;
}//Method end
}// End of class
Step to solve 18-9 is to enter the values in program and get the answers.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.