Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Deliverables : For this assignment you will submit two python files to the drop box. Name the main file: l astname_firstname_assign2.py and name the

Instructions

Deliverables:

For this assignment you will submit two python files to the drop box. Name the main file: lastname_firstname_assign2.py and name the module file: conversion.py.

Example: turner_randy_assign2.py

Create a program that converts feet to meters and vice versa.

Specifications

The formula for converting feet to meters is: feet = meters / 0.3048

The formula for converting meters to feet is: meters = feet * 0.3048

Store the code that performs the actual conversions in separate functions within a separate code module named "conversions.py". These two functions will take a single parameter and return the resulting conversion value. Close the file

Start a new .py file and use an "import" statement to import your custom module into this new file

Write a separate function to display the program banner/title

Write a separate function to display the menu as shown below in the sample output

Write the rest of the code to (1) take the user input (2) call the proper functions (3) display output all in a main() function. Note: The code inside the main() function should continue inside a While loop until the user is ready to quit.

Coding steps:

Display the title by calling the correct function

Display the menu by calling the correct function

Begin a loop and first ask the user for a conversion choice - save the input to a variable

Use an "if/elif/else" to determine which choice was made. If something was entered other than "a" or "b" alert the user.

If the choice is "a" or "b" then ask for the number of feet or meters. Make sure to convert this input to float() and save the result to a variable

Call the correct function from the "conversion.py" module, passing in the user input, to do the conversion calculation.

Print the results using the round() function

Prompt the user to continue or not. Exit the loop on "n" and print "Bye!"

NOTE: You can assume the user will enter valid data (no validation code required). Also, the program should round results to a maximum of two decimal places.

Sample input/output:

Feet and Meters Converter Conversions Menu: a. Feet to Meters b. Meters to Feet Select a conversion (a/b): a Enter feet: 100 The answer is 30.48 meters Would you like to perform another conversion? (y/n): y Conversions Menu: a. Feet to Meters b. Meters to Feet Select a conversion (a/b): b Enter meters: 100 The answer is 328.08 feet Would you like to perform another conversion? (y/n): n Thanks, bye!

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_2

Step: 3

blur-text-image_3

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 Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago

Question

I am paid fairly for the work I do.

Answered: 1 week ago

Question

I receive the training I need to do my job well.

Answered: 1 week ago