Question
Need a help on this PYTHON exercise. Write two user defined types: 1. a UDT to convert English distances to Metric 2. a UDT to
Need a help on this PYTHON exercise.
Write two user defined types:
1. a UDT to convert English distances to Metric 2. a UDT to convert Metric distances to English
Here are the measurement calculations: number = 10 centimeters = 0.3937 inches = 1 / centimeters feet = 12 meters = 100 miles = 5280 kilometers = 1000 km = number * ( feet * miles ) / ( centimeters * meters * kilometers) miles = number * ( meters * kilometers ) / ( inches * feet * miles )
For example, convert 10 miles to kilometers:
10 * ( feet * miles ) / ( centimeters * meters * kilometers) = 16.09 Convert 10 kilometers to miles:
10 * ( meters * kilometers ) / ( inches * feet * miles ) = 6.21 Demonstrate your classes (UDTs) work correctly for these calculations:
10 miles to kilometers 10 kilometers to miles 10 feet to meters 10 meters to feet 10 inches to centimeters 10 centimeters to inches Also make sure your classes work correctly for other combinations:
miles to meters feet to centimeters meters to inches kilometers to feet Try to do these conversions with as few IF statements as possible.
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