Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Could you explain to me how the calculations are done using this code!?
Sample output is hyp=5, oppo=4, and adj=3
Transcribed Image Text:Answer 1 of 1
Done
...
import math
E Calculate the length of the adjacent side of a right triangle
using the length of the hypotenuse and the adjacent angle.
def adjacent_length(hypotenuse, adjacent_angle):
Using hypotenuse and adjacent angle, we will use cosine to find the adjacent length
return hypotenuse • math.cos(nath.radians(adjacent_angle))
Calculate the length of the opposite side of a right triangle
using the length of the hypotenuse and the adjacent angle.
def opposite_length(hypotenuse, adjacent_angle):
EUsing hypotenuse and adjacent angle, we will use sine to find the opposite length
return hypotenuse nath.sin(nath.radians(adjacent_angle))
* calculate adjacent angle from hypotenuse and opposite
def adjacent_angle_from_opposite(hypotenuse, opposite):
Using the opposite and hypotenuse, we will use sine inverse to find the adiacent angle
sine inverse opposite / hypotenuse
sine in python is asin(opposite/ hypotenuse)
return math.degrees(nath.asin(opposite / hypotenuse))
* Calculate the adjacent angle from adjacent and opposite
def adjacent_angle_from_adjacent_opposite(adjacent, opposite):
Using the opposite and hypotenuse, we will use tan inverse to find the adjacent angle
tan inverse opposite / adjacent
tan in python is atan(opposite /adjacent)
return math.degrees(nath.atan(opposite / adjacent))
nain progran
def main():
hypotenuse- float(input("Enter the length of the hypotenuse: ")) = Ask Hypotenuse from user
opposite - float(input("Enter the length of the opposite: "))# Ask Opposite from user
ad jacent - float(input("Enter the length of the adjacent: "))E Ask Adjacent from user
angle - float(input("Enter the adjacent angle of the triangle: *)) = Ask angle from user
print("The length of the adjacent is: ", adjacent_length(hypotenuse, angle)) Print the length
of the adjacent
print("The length of the opposite is: ", opposite_length(hypotenuse, angle)) Print the length
of the opposite
print("The adjacent angle is: ", adjacent_angle_from_opposite(hypotenuse, opposite)) = Print the
ad jacent angle
print("The adjacent angle is: ",
adjacent_angle_from_adjacent_opposite(adjacent, opposite)) Print the adjacent angle
call main
-- ain_ *:
if _name
main()
Enter the length of the hypotenuse: 5
Enter the length of the opposite: 4
Enter the length of the adjacent: 3
Enter the adjacent angle of the triangle: 60
The length of the adjacent is: 2.50ø0000000000004
The length of the opposite is: 4.330127018922193
The adjacent angle is: 53.13010235415599
The adjacent angle is: 53.13010235415598
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 2 steps
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education