Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with this Python program problem! This is for an intro level programming class at Uni and the lecturer is horrible and only

Please help me with this Python program problem! This is for an intro level programming class at Uni and the lecturer is horrible and only teaches very simple ideas and his labs make no sense and he refuses to be helpful to anyone and tells us to use the internet. Thus, if you could help me make this program as he's outlined, with as many #comments as possible so I can try to learn something out of this!

Below is what he has posted as far as what we need to write the code. Like I said, the professor or TA's offers little to no help!

image text in transcribed

image text in transcribed

image text in transcribed

1. Write a semi-smart unit converter Conversion of various quantities between unit systems is a very common engineering task. The Python project for this term is to write a simple script that will do unit conversion for the user. Name the script that does this UnitConversion. py Domains The converter will work to convert units within specific domains. The domains should include time . ength mass capacity temperature force epressure . angles energy/moment power It is suggested, for the initial approach, that students figure out how to do one domain. Then expand to two or three of the domains listed. After those stages are working, add the others. Within each domain, there should be at least four different units supported. In addition, pick any four domains and support six types of units for that domain. The exception is angles, which need only support two units: degrees and radians Where applicable, roughly half of the units for a domain should be metric units (m, N, liters, etc.) and the other half should be U.S. Customary units (e.g. ft, lbi, gallons, etc.). Angles and time need not meet this requirement. Googling "common units for x" where x is a domain will yield handy units for each domain. Similarly, web searches will give conversion factors to high accuracy User Input The script should ask the user for a value and its units. The script will determine from those units which domain is involved and then present the user with a list of values in all of the units in that domain . The user will enter the number and then a space and then the units, all on one line The script should recognize common short abbreviations for units. E.g. W- Watts, lbf-pounds force, etc. It is okay to make the user match the internal unit string exactly If the units are not recognized, the script should print out a message and continue Input units that are multiplied are separated by a space. All units following a/sign are in the denominator. For example: in lbf/sec inch*pounds force/second . . By comparing the part of the string after the space, the script should determine the domain. The user does not have to enter the domain explicitly Output The script output should have the following features The output values should have 5 digits to the right of the decimal point. The output should not repeat the user's input units The output format should print in a neat format, with the output values' decimal points aligned for each output quantity. See the example output below for guidance The user will be given the option to do another after each unit conversion is complete. If the user enters anything other than 'Q' or 'q', the script should continue . The user should have an option to type H for help and see a short example of what could be entered as well as a summary of the domains and units that are recognized. The help should be human-readable and should not have unneeded brackets, braces, etc. from list or dictionary data that has not been formatted Calculations Conversion factors should have at least 6 significant figures Note that most units can be converted using a single factor in unit2 const x unit1 fashion. E.g. 1 meter 39.3701 inches. But, some, like temperature, follow a unit2-consti x uniti constz pattern and will require two constants. A clever programmer can use the same system for both types, by allowing constz to be 0 for the domains that don't need it. The project script is to be written using no scientific or mathematical modules that the student has not written independently. The project scope is well within the programming ability of ME 021 students Hint on setting up the math: Rather than work out all of the combinations of unit conversions within a domain (which will be quite a few for domains with 6 units), it may be useful to pick one unit as the "standard" for each domain (it won't matter which one is chosen) and then determine how to go from any unit to that standard unit and then go from that standard unit to the others. Code Flexibility The code should be written so that adding new units to domains and adding new domains requires changing only a few lines of code without adding whole new variables. For instance, adding a new domain should not require a new variable to be declared, just that a previously defined list or dictionary be expanded. Similarly, the help output that tells the users what units and domains are available should be generated automatically from the data lines. This can easily be accomplished by using dictionaries to hold the domains and unit strings. Examples: The following is an example run. Note that it tests the help and quit features and prints the help message when unrecognized units are used. The results are in a tidy format with numbers in a straight column. C: \Users brokow\UCM Classes \ME 02112019 Spring Assignments>UnitConverter.py K> Unit Converter: At any prompt, enter H for help, Q to quit.UnitConverter.py K> Unit Converter: At any prompt, enter H for help, Q to quit.

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

Explain how to control impulses.

Answered: 1 week ago