Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C program C program Once the moment of inertia has been determined, calculate the deflection from the formula: deflection - (PL)(BEI). Print the deflection at
C program
C program
Once the moment of inertia has been determined, calculate the deflection from the formula: deflection - (PL)(BEI). Print the deflection at the end of the beam in inches, in exponential notation, with 4 digits after the decimal point. When the program is working, modify it using a while or do...while loop so that the program will continue prompting the user to see if the program is to be run again for a different cross section and/or cross sectional dimensions. After the deflection is printed the user will be asked if he/she wants to do another deflection calculation. He/she might enter Y (or 1) to continue or N (or 2) to quit. 2. The following equation describes the voltage of a capacitor in a certain RC circuit as it is charging from a starting value of 0 volts to a final value of 10 volts: V = 10-10-15 the Write a program to print a table of time and corresponding voltage values, method described below. In function main, prompt the user to enter a limiting voltage greater than 0 and less than 10 volts for the table and use a while or do while input validation loop to prompt the user to re-enter the limiting voltage value if it is outside the range between 0 and 10. Use a while loop to print a table of time and voltage values from t=0 up until the time at which the voltage reaches the desired value. Include column headings outside the loop. Print values at time intervals of 0.005 seconds. Print values only as long as the voltage is less than the limiting voltage input by the user. In the table, place time values in the column on the left and voltage values in the column on the right. Print the table using 3 digits after the decimal point for time and 5 digits after the decimal point for voltage. Test with a limiting voltage value of 6.3 volts. C Programming Assignment 4 While Loops and Switch Submit .c files and sample executions for each of the programs described below on Canvas under Assignments, Observe the sun guidelines regarding the initial cortiment section, indenting, mud soon In addition, indent statements within loopt. 1. Acantilever beam (fixed at the lett end and free at the other of length Liis picture below. It is subjected to load P200 lb at the end. Such loading remolts in deflection of the beam downward and a resulting curvature of the beam DILECTIONS AND SLOPES OF CANITLAYER TEAM L- (4) - deliction at right end of beam 0-19-angle at right and ol beam Consider a steel cantilever beam with modulus of elasticity E=30* 10lb/in? Write a program to calculate the deflection at the end of the beam () for a given cross section of the beam. Define E and PI as constants. Prompt the user to input a value for the length of the beam L. Restrict the length L of the beam to a value between 16 and 24 inches by using a while data validation loop. Print a mena for the user to select the type of cross section of the beam. The user should enter a letter corresponding to one of the following options: R===> rectangular cross section T===> triangular cross section C===> circular cross section Use a switch statement to calculate the moment of inertial for the different cases according to the formulas shown below. Within each case, the user should be prompted to enter base, height, and/or radius as appropriate Include a default for an improper choice. Also make sure your switch statement can accommodate both upper and lower case letters. Once the moment of inertia has been determined, calculate the deflection from the formula: deflection - (PL)(BEI). Print the deflection at the end of the beam in inches, in exponential notation, with 4 digits after the decimal point. When the program is working, modify it using a while or do...while loop so that the program will continue prompting the user to see if the program is to be run again for a different cross section and/or cross sectional dimensions. After the deflection is printed the user will be asked if he/she wants to do another deflection calculation. He/she might enter Y (or 1) to continue or N (or 2) to quit. 2. The following equation describes the voltage of a capacitor in a certain RC circuit as it is charging from a starting value of 0 volts to a final value of 10 volts: V = 10-10-15 the Write a program to print a table of time and corresponding voltage values, method described below. In function main, prompt the user to enter a limiting voltage greater than 0 and less than 10 volts for the table and use a while or do while input validation loop to prompt the user to re-enter the limiting voltage value if it is outside the range between 0 and 10. Use a while loop to print a table of time and voltage values from t=0 up until the time at which the voltage reaches the desired value. Include column headings outside the loop. Print values at time intervals of 0.005 seconds. Print values only as long as the voltage is less than the limiting voltage input by the user. In the table, place time values in the column on the left and voltage values in the column on the right. Print the table using 3 digits after the decimal point for time and 5 digits after the decimal point for voltage. Test with a limiting voltage value of 6.3 volts. C Programming Assignment 4 While Loops and Switch Submit .c files and sample executions for each of the programs described below on Canvas under Assignments, Observe the sun guidelines regarding the initial cortiment section, indenting, mud soon In addition, indent statements within loopt. 1. Acantilever beam (fixed at the lett end and free at the other of length Liis picture below. It is subjected to load P200 lb at the end. Such loading remolts in deflection of the beam downward and a resulting curvature of the beam DILECTIONS AND SLOPES OF CANITLAYER TEAM L- (4) - deliction at right end of beam 0-19-angle at right and ol beam Consider a steel cantilever beam with modulus of elasticity E=30* 10lb/in? Write a program to calculate the deflection at the end of the beam () for a given cross section of the beam. Define E and PI as constants. Prompt the user to input a value for the length of the beam L. Restrict the length L of the beam to a value between 16 and 24 inches by using a while data validation loop. Print a mena for the user to select the type of cross section of the beam. The user should enter a letter corresponding to one of the following options: R===> rectangular cross section T===> triangular cross section C===> circular cross section Use a switch statement to calculate the moment of inertial for the different cases according to the formulas shown below. Within each case, the user should be prompted to enter base, height, and/or radius as appropriate Include a default for an improper choice. Also make sure your switch statement can accommodate both upper and lower case letters
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started