I have this c++ project that i need help with ! Up until this point, I only have
ID: 3682507 • Letter: I
Question
I have this c++ project that i need help with ! Up until this point, I only have nested switch cases for the program, 3 cases for the three load types, and each case has 7 nested cases in them for the selection of one of the 7 materials and its E=young modulus of elasticity, value. After that I have trouble creating the functions and I get some errors in initialiazation which i dont know how to fix, and I can figure out how to clear the screen like the programm is asking! Please help me ! Here is some information on the project:
QUESTIONS:Write a C++ program according to the following specifications
1. Display a brief description of the program.
2. Ask the user to specify the type of loading (end load, intermediate load, uniform load)
3. Ask the user to specify the type of material (give the user of menu of 7 material types listed above) and then use the given value of E.
4. Ask the user for the beam dimensions (L, B, b, H, and h). Use a function to find the moment of inertia. (where: the lowercase ‘b’ is the flange width parameter for calculating I, moment of inertia).
5. If an end load or intermediate load is chosen, prompt the user to enter the weight of the load.
6. If a uniform load is selected, prompt the user to enter the weight density.
7. If an intermediate load is chosen, prompt the user to enter the value of ‘a’ (the location of the load).
8. Create 3 functions to calculate for the three types of loading.
9. Prompt the user to specify the number of points, N (in addition to x = 0) to use in a table of x and values.
10. Clear the screen and display the following:
A brief description of the program.
The type of loading and type of material.
All input quantities (both variable and name) with units. Also display I.
Display a table of values of x and with an appropriate table heading (with units) and with all values nicely aligned. Other important notes: User prompts should include both symbol and name of variable and unit.
Use scientific notation with 4 significant digits for most results.
Check all inputs for errors. If any inputs are entered incorrectly, allow the user to correct them. Error checks include: o Incorrect menu choices o All beam dimensions, weights, and weight density must be positive o H > h, B > b, L > a, and a > 0
Give the user the option of re-running the program.
INFORMATION: The analysis of beams is an important topic in mechanical engineering. One type of beam considered is a cantilever beam in which one end of the beam is fixed and the other end of the beam is free.
When a weight, W, (or load) is applied the free end of the beam, the beam deflects or bends. The amount of deflection, , on the free end of the beam depends on the beams loading conditions. There are many types of loading conditions, but three types are considered here: 1) End load - A single load, W, is applied at the free end of the beam 2) Intermediate Load – A single load, W, is applied at point B (somewhere between the free end and the fixed end) 3) Uniform Load – The load W is uniformly distributed along the length of the beam.
W = total weight of load (N)
= deflection caused by the load (m),
x = distance from the free end of the beam (m),
L = length of the beam (m),
w = load density (N/m).
For a uniform load, W = w*L [(N/m)(m) = N]
The deflection for each beam can be calculated using the following relationships, assuming that the forces on the beam are coplanar, the beam is in static equilibrium, and that the weight of the beam may be neglected:
1) End Load: =(-W/6*E*I)*(x^3 -3*L^2*x+2*L^3)
( 2) Intermediate Load: for 0<=x<=b =(-W/6*E*I)(-a^3+3*a^2*L-3*a^2*x) OR for b<=x<=L =(-W/6*E*I)*((x-b)^3-3*a^2*(x-b)+2*a^3)
3) Uniform Load: =(-W/6*E*I)(x^4-4*L^3*x+3*L^4)
where:
E = Young’s modulus of elasticity (N/m2 ),
I = moment of inertia (m4 ),
L = length of beam (m, meters).
For the Intermediate Load, the following terms also apply:
a = distance from FIXED end of beam to application of the load (m, meters),
b = L – a.
For the Uniform Load: Weight = (Weight Density)(Beam Length) or W = (w)(L).
Young’s modulus of elasticity varies with different types of materials. The following are typical values:
Material and Young’s modulus (N/m2 ):
Aluminum 6.90 x 1010
Brass 11.7 x 1010
Carbon Steel 20.5 x 1010
Cast Iron 10.0 x 1010
Oak 1.10 x 1010
Stainless Steel 19.0 x 1010
Titanium 11.4 x 1010.
It will be assumed that the beam under consideration is an I-beam with the following dimensions:
H =outer height of I - Beam (m), h= inner height of I - Beam (m), B = outer width of I - Beam (m), b = width of both flanges of I - Beam (m)
The moment of inertia, I,for theI-Beam can be calculated as follows: I=(B*H^3 - 2*b*h^3)/12 (m^4)
Explanation / Answer
once you #include <conio.h>
you can use clrscr() to clear the scrren
#include <iostream.h> // input output stream header file
#include <stdio.h> // standard input output header file
#include <stdlib.h> // standard library header file
#include <string.h> // header file with string function
#include <conio.h> // console input output header file
void describe() {
cout << " A Brief description of the program: ";
cout << " ";
}
endLoad() {
} // end func end ld
interLoad() {
} // end func inter ld
uniLoad() {
} // end fun unif ld
int main() // start main
{
clrscr(); // to clear the screen
char typeChoice, loadType;
double wt, wtdnsty, a;
int numPts;
cout << " Enter the load type: e = end load, i = intermediate load, u = uniform load";
cin >> loadType;
if ( loadType == 'e' ) || ( loadType == 'i' ) ) {
cout << " Enter weight of the load";
cin >> wt;
} // end if
if ( loadType = 'u' ) {
cout << " ENter the weight density:";
cin >> wtdnsty;
}
if (loadType == 'i') {
cout << " Enter the location of the load a ";
cin >> a;
}
cout << " Enter the type of material: ";
cout << " A = Aluminium B = Brass S = Carbon Steel";
cout << " I = Cast Iron O = Oak L = Stainless Steel T = Titanium";
cin >> typeChoice;
cout << " Enter the beam dimensions: Length, H, h, B, b";
cin >> L >> H >> h >> B >> b ;
cout << " Enter the number of points:";
cin >> numPts;
return 0; // exit
} // end of main()
Regarding the nested switch statements, the closing brackets have to match with switch opening bracket