Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The 1st and 4th pictures are for Program 1 and The 2nd and 3rd pictures are for program 2. Deliverables for Lab Assignment 3b. Please

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
The 1st and 4th pictures are for Program 1 and The 2nd and 3rd pictures are for program 2. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Deliverables for Lab Assignment 3b. Please complete Program 1 and Program 2 of Activity 14 as described below. Each program is an individual assignment, but you may consult your teammates and others as you work. Please submit the following files to the Submission Box labeled "Lab Assignment 3b Individual Activities." Lab Aet Progla.py" "Lab3b_Acte_Progib.py" Act 4 Progle.py" "Lab Act Progid.py" "Lab3b_Act 4_Prog2.py" Please include individual header information at the top of each file. Please submit all files on the list as one submission. Please do not zip the files Activity 4 Writing Programs - Individual Activity Program 1: This assignment is meant to give you practice with the request information/gather input/perform computation output result program structure Begin with Programs from the previous two individual assignments). You are to convert four of the calculations from that assignment into four new programs that each read in data from the user via the keyboard and output the answer to the console. You should use the same variables as before, but instead of just assigning values to each, you should input values from the keyboard as appropriate Please use O w ly learned formatting techniques to output each result to four decimal places Please name the programs Labb_et_Progla.py. Lab3b_et_Progin.pyand so on Here are the four calculations to convert to interactive programs: a) Use Ohm's law to calculate the voltage (V) across a conductor with a given resistance in ohms and a given current in amperes. b) Calculate the kinetic Energy of an object with a given mass (kgland velocity (m/s) c) Calculate the shear stress (lbf/in^2) for a given normal stress (lbt/in 2) that is applied to a material with a given cohesion (ibf/in 2) and angle of internal friction (degrees. (See Mohr Coulomb failure criterion) d) Calculate the production of a well barrels/day after a given number of days for a given initial production rate (barrels/day), initial decline rate (barrels/day), and hyperbolic constantino dimensions). (See Arps Equation.) Each program should perform the following tasks: Print what the program does to the screen Example: This program calealates Lisette energy given a nd velocity Prompt the user to enter required data from the keyboard. Include proper units in the prompt as shown below Based upon Dr.Keysers Original Lab Assignment Example: Please ter the sake Get the inputs from the user and store in appropriately named variables Perform the necessary calculations Output the result to the screen with proper labels and units Example: Kinetie Energy - 575.2367 3 As always, please include descriptive comments in your code so that someone may follow your programming logic Program This program provides practice for writing programs to perform more complex numerical calculations and specifically to give you practice with vector calculation Write a program that calculates the angle between two po s ebnover your program should read the following data from the keyboard The 3 position of an observer The position of the first observed point The 3 position of the second observed point The program should calculate and output. in degrees, the angle betwe e n from the conver's perspective Below is a list of steps for your Python code to c o m e on how to accomplish each step. Please refer to the figure above Read the point locations from the keyboard the points will be coordinates and all measured in the same units Note that the r er med not be at the origin Also note that the three points should be coordinates for each pot . Soon, we will learn how to force the w a lly using Python - Create the two vectors from the observer to each of the other points Let's say the Observer is at location and point is location Then Vector from the Observer to Point - y -2) Normalize the vectors Based upon tv. K er's Original Review 2019 Lab Assignment This means to find a unit vector vector of one the same directions each of the two vectors Calculate the dot product between the mora d ors Use the dot product result to let the angebenhet b eds te that the dot product of two nored vectors gives the case of the ance between these vector - Output the answer in degrees a t the capaces Before you beginning coding you should stop and th o ut there you will need for your When testing program that we mots from the keyboard it can be quite frustrating to have to the inputs every time you want to the program. One technique for dealing with this problem is to hand code the va l ues during the de pro then add the code torve the from the band you are sure the code works by hard code w o men to the code rather that bring values from the keyboard) As described in previous activities, be kind to the Print Prompt the user what to enter and in what format or what t justprinta b er to the screen h the program does to the screen e the output explicitly. Don't Program: This program provides practice for writing programs to perform more complex numerical calculations, and specifically to give you practice with vector calculation Write a program that calculates the angle between two points, as seen by an observer. Your program should read the following data from the keyboard: The 30 position of an observer The 3D position of the first observed point The 3D position of the second observed point The program should calculate and output, in degrees, the angle between the points from the observer's perspective. Below is a list of steps for your Python code to execute along with some hints on how to accomplish each step. Please refer to the figure above Read the point locations from the keyboard. Assume the points will be coordinates and all measured in the same units O Note that the observer need not be at the origin Ako note that the three points should be distinct-eter une coordinates for each - . Soon, we will learn how to enforce this rule automatically using Python Create the two vectors from the observer to each of the other points Let's say the Observer is at location (Xey ) and Point is location Then Vector from the Observer to Point is simply V - - - Normale the vectors -2) . Based upon Dr. Kayer's Original Lab Assignment 36 This means to find a unit vector vector of magnitude one in the same direction as each of the two vectors Calculate the dot product between the normalized vectors Use the dot product result to calculate the angle between the two observed points. Note that the dot product of two normalized vectors gives the cosine of the angle between these vectors Output the answer in degrees (Please limit the dig e st Before you beginning coding you should stop and think briefly about the wables you will need for your program. Sample Output: Your format may vary, but this is a correct result for the inputs shown Observer location is Point 1 location is Point 2 location is 10 y 2.0 4 y 5. eye 6 . The angle between the points is 25.2 degrees Helpful Hint: When testing/debugging a program that requires several inputs from the keyboard, it can be quite frustrating to have to retype the inputs every time you want to the One technique for dealing with this problem is to simply "hard code the variable values during the debugging process, then add the code to retrieve the input from the keyboard ather you are sure the code works. (By "hard code we simply mean to sign variable values in the code rather that trieving values from the keyboard) As described in previous activities, be kind to the user. Print what the program does to the screen Prompt the user what to enter and in what format or what units. Also, label the output explicitly. Don't just print a number to the screen Deliverables for Lab Assignment 3b. Please complete Program 1 and Program 2 of Activity #4 as described below. Each program is an individual assignment, but you may consult your teammates and others as you work. Please submit the following files to the Submission Box labeled "Lab Assignment 3b Individual Activities." Lab At Progla.py" Lab Aet Proglb.py" ab Act 4 Progle.py "Lab3b_Acte_Progid.py" Act 4 Pro2.py" Please include individual header information at the top of each file. Please submit all files on the list as one submission. Please do not zip the files Activity 14: Writing Programs Individual Activity Program 1 This assignment is meant to give you practice with the request information gather input/perform computation/output result/program structure. Begin with Program 1 from the previous two individual assignments). You are to convert four of the calculations from that assignment into four new programs that each read in data from the user via the keyboard and output the answer to the console. You should use the same variables as before, but instead of just assigning values to each, you should input values from the keyboard as appropriate Please use our newly learned formatting techniques to output each result to four (4) decimal places Please name the programs Lab3b_ 4_Progla.py, Lab3b_net_Proglb.py, and so on. Here are the four calculations to convert to interactive programs: b) a) Use Ohms Law to calculate the voltage (V) across a conductor with a given resistance in ohms and a given current in amperes. Calculate the Kinetic Energy of an object with a given mass (kg) and velocity (m/s). c) Calculate the shear stress (lbt/in 2) for a given normal stress ibt/in2) that is applied to a material with a given cohesion (lbf/in^2) and angle of internal friction (degrees). (See Mohr Coulomb failure criterion) d) Calculate the production of a well (barrels/day) after a given number of days, for a given initial production rate barrels/day), initial decline rate (barrels/day), and hyperbolic constantino dimensions). (See Arps Equation) Each program should perform the following tasks: Print what the program does to the screen Example: This program calculates kinetic energy given and velocity Prompt the user to enter required data from the keyboard. Include proper units in the prompt as shown below. Based upon Dr. Kayser's Original Lab Assignment 3 Example: Please enter the mass o Get the inputs from the user and store in appropriately named variables Perform the necessary calculations Output the result to the screen with proper labels and units Example: Kinetie Energy - 575.2367 As always, please include descriptive comments in your code so that someone may follow your programming logic. Activity #4: Writing Programs - Individual Activity Program 1: This assignment is meant to give you practice with the /request information/gather input/perform computation/output result/ program structure. Begin with Program #1 from the previous two individual assignment(s). You are to convert four of the calculations from that assignment into four new programs that each read in data from the user via the keyboard and output the answer to the console. You should use the same variables as before, but instead of just assigning values to each, you should input values from the keyboard as appropriate. Please use our newly-learned formatting techniques to output each result to four (4) decimal places. Please name the programs Lab3b_Act 4 Progla.py, Lab3b_Act4_Proglb.py, and so on. Here are the four calculations to convert to interactive programs: a) Use Ohm's Law to calculate the voltage (V) across a conductor with a given resistance in ohms and a given current in amperes. b) Calculate the kinetic Energy of an object with a given mass (kg) and velocity (m/s). c) Calculate the shear stress (lbf/in^2) for a given normal stress (lbf/in^2) that is applied to a material with a given cohesion (Ibf/in^2) and angle of internal friction (degrees). (See Mohr- Coulomb failure criterion) d) Calculate the production of a well (barrels/day) after a given number of days, for a given initial production rate (barrels/day), initial decline rate (barrels/day), and hyperbolic constant (no dimensions). (See Arps Equation.) Each program should perform the following tasks: Print what the program does to the screen Example: This program calculates kinetic energy given mass and velocity Prompt the user to enter required data from the keyboard. Include proper units in the prompt as shown below. Program 2: This program provides practice for writing programs to perform more complex numerical calculations, and specifically to give you practice with vector calculations. Write a program that calculates the angle between two points, as seen by an observer. Your program should read the following data from the keyboard: - The 3D position of an observer The 3D position of the first observed point The 3D position of the second observed point The program should calculate and output, in degrees, the angle between the points from the observer' perspective. Below is a list of steps for your Python code to execute along with some hints on how to accomplish each step. Please refer to the figure above. Read the point locations from the keyboard. Assume the points will be (x, y, z) coordinates and all measured in the same units. O Note that the observer need not be at the origin. o Also note that the three points should be distinct - enter unique coordinates for each point. . Soon, we will learn how to enforce this rule automatically using Python Create the two vectors from the observer to each of the other points Let's say the Observer is at location (xo, Yo, 2o) and Point 1 is at location(x, y, z). Then Vector 1 from the Observer to Point 1 is simply V1 = (x1 - Xo Yi - Yo. 21-20) Normalize the vectors Based upon Dr. Keyser's Original Revised Summer 2019 TLF Lab Assignment #3b o This means to find a unit vector (vector of magnitude one (1)) in the same direction as each of the two vectors Calculate the dot product between the normalized vectors Use the dot product result to calculate the angle between the two observed points. Note that the dot product of two normalized vectors gives the cosine of the angle between those vectors. Output the answer in degrees (Please limit the displayed result to two (2) decimal places.) Before you beginning coding, you should stop and think briefly about the variables you will need for your program Sample Output: Your format may vary, but this is a correct result for the inputs shown. Observer location is - 1.0 y 2.0 2- 3.0 Point 1 location is x- 4.0 y 5.0 - 6.0 Point 2 location is x 9.0 y= 8.0 2 7.0 The angle between the points is 15.23 degrees a) Use Ohm's Law to calculate the voltage ( across a conductor with a given resistance in ohms and a given current in amperes. b) Calculate the kinetic Energy of an object with a given mass (kg) and velocity (m/s). c) Calculate the shear stress (lbf/in^2) for a given normal stress (Ibf/in^2) that is applied to a material with a given cohesion (Ibf/in^2) and angle of internal friction (degrees). (See Mohr- Coulomb failure criterion) d) Calculate the production of a well (barrels/day) after a given number of days, for a given initial production rate (barrels/day), initial decline rate (barrels/day), and hyperbolic constant (no dimensions). (See Arps Equation.) Each program should perform the following tasks: Print what the program does to the screen O Example: This program calculates kinetic energy given mass and velocity Prompt the user to enter required data from the keyboard. Include proper units in the prompt as shown below. Based upon Dr. Keyser's Original Revised Summer 20191 Lab Assignment #: Example: Please enter the mass (kg): Get the inputs from the user and store in appropriately named variables Perform the necessary calculations Output the result to the screen with proper labels and units o Example: Kinetic Energy = 575.2367 J As always, please include descriptive comments in your code so that someone may follow your programming logic

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

Students also viewed these Databases questions