Write a program which accomplishes the following requirements: 1. On execution, the program must display the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program which accomplishes the following requirements: 1. On execution, the program must display the name (describing the main functionality) of the program and ask the user for the input file name and output file name. If the input file does not exist, print an error message and ask the user for the file name again. The program output (to the screen) during the user input stage should look like the following snapshot: CENTROIDAL MOI CALCULATOR INPUT: Please enter input file name: input.xt ERROR: Input file not exist... Please re-enter input file name: input.txt Please enter output file name: output.txt 2. The input file to the program contains a single line header that describes the column names, followed by the input specification (type and radius) for each case in the form of <TYPE> <RADIUS> where <TYPE> is specified as a single character, whereas <RADIUS> is specified as numeric values. Example input program is shown below (with error in types and values included): ...ments/teaching-2021202202/5c/project_c/input.txt - KWrite File Edit View Bookmarks Tools Settings Help Open... Save As... Type Radius A 0.3 New 1 2 3 B 1 4567BSOL с 0.1 A 3.20E+01 A 1.60E+04 B0 8 B-2 C 3 10 D 5 11 | Save Close 3. Calculation of moment of inertia for different shapes must be implemented inside their respective functions. The error must be indicated if the shape type is not in the given list in Table 1 and/or a zero and negative value for radius is given. 4. Output of the program should be both printed on the screen and written to the named output file, in the form of <TYPE> <RADIUS> <MOI_X> <MOI_Y> with a corresponding single line header. The error must be indicated for specific cases in the output. For the above input, the content of the output file should look like the following snapshot: ...ents/teaching-2021202202/SE.../project_c/output.txt — KWrite File Edit View Bookmarks Tools Settings Help Save As... New Open... Save Type Radius MOIX MOIY A 3.000e-01 6.363e-03 6.363e-03 B 1.000e+00 1.898e-01 3.927e-01 C 1.000e-01 5.492e-06 3.928e-05 A 3.200e+01 8.237e+05 8.237e+05 A 1.600e+04 5.148e+16 5.148+16 B 0.000e+00 "INPUT_ERROR" B -2.000e+00 "INPUT_ERROR" C 3.000e+00 4.449e+00 3.181e+01 D 5.000e+00 "INPUT_ERROR" e 8 of 11, Column 16, Words (V82, Chars 0/2 INSERT Clase + Tabs: 2 v TF V n 5. You need to generously describe your code via comments (either use /* ) */ or // The overall program execution should look like the following snapshot: project_c: cb_console_runn - Konsole File Edit View Bookmarks Settings Help CENTROIDAL MOI CALCULATOR INPUT: Please enter input file name: input.xt ERROR: Input file not exist... Please re-enter input file name: input.txt Please enter output file name: output.txt OUTPUT: Type Radius MOIX MOIY A 3.000e-01 6.363e-03 6.363e-03 B 1.000e+00 1.098e-01 3.927e-01 C 1.000e-01 5.492e-06 3.928e-05 A 3.200e+01 8.237e+05 8.237e+05 A 1.600e+04 5.148e+16 5.148e+16 B 0.000e+00 "INPUT ERROR" B -2.000e+00 "INPUT_ERROR" C 3.000e+00 4.449e+00 3.181e+01 D 5.000e+00 "INPUT_ERROR" Process returned 0 (0x0) Press ENTER to continue. execution time: 25.714 s input.txt 11-21222 Programming for Engineers Section 11 Type Radius A 0.3 B 1 C 0.1 A 3.20E+01 A 1.60E+04 B0 B-2 C 3 D 5 input_for_win.txt22 Programming for Enginee Section Type Radius A 0.3 B 1 C 0.1 A 3.20E+01 A 1.60E+04 ВО B-2 C 3 D 5 Formulas to calculate the moment of inertia about the centroid of 3 different circle-based shapes are given below. Table 1: Selected formulas to calculate moment of inertia for different shapes Type Shape MOI about centroidal x' axis MOI about centroidal y' axis 4 = 3² A B () 9 0 TAI T3L 8 4 = (-2)* 4 = (-2)* 3² 11 Write a program which accomplishes the following requirements: 1. On execution, the program must display the name (describing the main functionality) of the program and ask the user for the input file name and output file name. If the input file does not exist, print an error message and ask the user for the file name again. The program output (to the screen) during the user input stage should look like the following snapshot: CENTROIDAL MOI CALCULATOR INPUT: Please enter input file name: input.xt ERROR: Input file not exist... Please re-enter input file name: input.txt Please enter output file name: output.txt 2. The input file to the program contains a single line header that describes the column names, followed by the input specification (type and radius) for each case in the form of <TYPE> <RADIUS> where <TYPE> is specified as a single character, whereas <RADIUS> is specified as numeric values. Example input program is shown below (with error in types and values included): ...ments/teaching-2021202202/5c/project_c/input.txt - KWrite File Edit View Bookmarks Tools Settings Help Open... Save As... Type Radius A 0.3 New 1 2 3 B 1 4567BSOL с 0.1 A 3.20E+01 A 1.60E+04 B0 8 B-2 C 3 10 D 5 11 | Save Close 3. Calculation of moment of inertia for different shapes must be implemented inside their respective functions. The error must be indicated if the shape type is not in the given list in Table 1 and/or a zero and negative value for radius is given. 4. Output of the program should be both printed on the screen and written to the named output file, in the form of <TYPE> <RADIUS> <MOI_X> <MOI_Y> with a corresponding single line header. The error must be indicated for specific cases in the output. For the above input, the content of the output file should look like the following snapshot: ...ents/teaching-2021202202/SE.../project_c/output.txt — KWrite File Edit View Bookmarks Tools Settings Help Save As... New Open... Save Type Radius MOIX MOIY A 3.000e-01 6.363e-03 6.363e-03 B 1.000e+00 1.898e-01 3.927e-01 C 1.000e-01 5.492e-06 3.928e-05 A 3.200e+01 8.237e+05 8.237e+05 A 1.600e+04 5.148e+16 5.148+16 B 0.000e+00 "INPUT_ERROR" B -2.000e+00 "INPUT_ERROR" C 3.000e+00 4.449e+00 3.181e+01 D 5.000e+00 "INPUT_ERROR" e 8 of 11, Column 16, Words (V82, Chars 0/2 INSERT Clase + Tabs: 2 v TF V n 5. You need to generously describe your code via comments (either use /* ) */ or // The overall program execution should look like the following snapshot: project_c: cb_console_runn - Konsole File Edit View Bookmarks Settings Help CENTROIDAL MOI CALCULATOR INPUT: Please enter input file name: input.xt ERROR: Input file not exist... Please re-enter input file name: input.txt Please enter output file name: output.txt OUTPUT: Type Radius MOIX MOIY A 3.000e-01 6.363e-03 6.363e-03 B 1.000e+00 1.098e-01 3.927e-01 C 1.000e-01 5.492e-06 3.928e-05 A 3.200e+01 8.237e+05 8.237e+05 A 1.600e+04 5.148e+16 5.148e+16 B 0.000e+00 "INPUT ERROR" B -2.000e+00 "INPUT_ERROR" C 3.000e+00 4.449e+00 3.181e+01 D 5.000e+00 "INPUT_ERROR" Process returned 0 (0x0) Press ENTER to continue. execution time: 25.714 s input.txt 11-21222 Programming for Engineers Section 11 Type Radius A 0.3 B 1 C 0.1 A 3.20E+01 A 1.60E+04 B0 B-2 C 3 D 5 input_for_win.txt22 Programming for Enginee Section Type Radius A 0.3 B 1 C 0.1 A 3.20E+01 A 1.60E+04 ВО B-2 C 3 D 5 Formulas to calculate the moment of inertia about the centroid of 3 different circle-based shapes are given below. Table 1: Selected formulas to calculate moment of inertia for different shapes Type Shape MOI about centroidal x' axis MOI about centroidal y' axis 4 = 3² A B () 9 0 TAI T3L 8 4 = (-2)* 4 = (-2)* 3² 11
Expert Answer:
Answer rating: 100% (QA)
To create a program that fulfills the requirements shown in the images you need to follow these step... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these accounting questions
-
Write a program which read the following (3x3 dimensional) array and then display it. (C++ Language) 10 50 70 40 80 30 20 55 60
-
Write a program which allows the user to perform simple tasks on a calculator. A series of methods allows the to select user an operation to perform and then enter operands. The first method displays...
-
Write a program which asks the user to enter the width and height of a rectangle. Pass these values to a function Area to compute the area of the rectangle. Display the area in the function main.
-
Dodona I, LLC, invested $ 4 million in two securities offerings from Goldman, Sachs & Co. The investments were in collat-eralized debt obligations ( CDOs). Their value depended on residential...
-
How can profitability ratios allow insight into the effectiveness of management? Liquidity ratios? Activity ratios? Leverage ratios?
-
Looking at the Board of Certified Safety Professionals' code of ethics, which two items do you perceive as the most important and why?
-
Explain the elements of a contract.
-
Lets say your boss develops an EFE Matrix that includes 62 factors. How would you suggest reducing the number of factors to 20?
-
Part B (i) Four years ago, you purchased a 10 year bond issued by Blinken International, a global supplier of food additives for Year Expected payments What was your expected return (%/year)? $44,950...
-
Consider an abatement cost function C(e,)=(abe) 2 /2b, where is the amount of private investment to reduce abatement costs. There are J identical firms. The social damage function is D(E)=dE 2 /2....
-
Increased and volatile demand combined with constrained supply challenged the supply chain during the pandemic. A spokesperson for Clorox stated demand for Clorox wipes increased 500% during the...
-
You will recall, this is the Black-Scholes model, where Call = current call option value SO= current Stock price K = strike price N(d) = the probability that a random draw from a standard normal...
-
The truss shown in the figure spans a total space of 18.0 ft and carries two concentrated loads on its top chord. The members are made from standard steel angle and channel shapes as indicated in the...
-
The Northwest Flower Company owns a greenhouse, which furnishes roses and carnations to florists in Oregon, Washington, and Idaho. The greenhouse can grow any combination of the two flowers. They...
-
Statement of Advice 1 Prepare a tax return for an entity (Australian private company) (10 marks for technical and calculation accuracy and relevance and 10 marks for writing style; refer to marking...
-
The delta of a digital option that pays $1 when S(T)>K is e-T n(d2 )/[OST/2] Create an Excel worksheet in which the user input K, r, o, q and T. Compute the delta of the digital option for stock...
-
A person wants to know if they are eligible for any government benefit. Use CRA resources to explain your answer. Also, Explain the basic criteria for claiming "eligible dependent amount ".
-
Calculate I, , and a for a 0.0175 m solution of Na 3 PO 4 at 298 K. Assume complete dissociation. How confident are you that your calculated results will agree with experimental results?
-
Mark owns his home and has a $250,000 mortgage related to his purchase of the residence. When his daughter went to college in the fall of 2012, he borrowed $20,000 through a home equity loan on his...
-
Sherry Hopson owns a retail family clothing store. Her store is located at 4321 Circle Drive, Houston, TX 77001. Her employer identification number is 95- 1234321 and her Social Security number is...
-
Sally and Charles Heck received the following dividends and interest during 2012: Assuming the Hecks file a joint tax return, complete Schedule B of Form 1040 (on page 2-33) for them for the 2012 tax...
-
Reconsider the data from Problem 57 (Orpheum Productions lighting enhancement). Assume that any money not invested in the lighting enhancements will be placed in an interest-bearing account earning...
-
An investor has \($100,000\) to invest in a business venture, or she can earn 10 percent/year with a \($100,000\) certificate of deposit for 4 years. Three possible business ventures have been...
-
This problem is related to Problem 8. Jeff has $10,000 to invest for a period of 5 years. The following three alternatives are available at his bank: Data from problem 8 Jeff has $10,000 to invest...
Study smarter with the SolutionInn App