Module and Import
For these 3 problems,
-You are writing a function to calculate a formula in the module.
-You are going to import the modules to the main.
-Write 3 more functions in the main
-Don't do any formula calculation in the main just use module functions and return your result.
-Call each main function twice to test the provided values.
1. Meter to Feet and Inches
One meter equals 39.37 inches and 1 foot equals 12 inches.
Write a function m_2_ft_inch (m) under the module meter_feet.py.
Import it to the main and another function named meter_to_feet_n_inch (meter) in the main. Call your function twice to test these 2 values.
i) 78 meter
ii) 245 meter
Hint: Use the remainder to solve this problem
Note: The result must be in feet and inches, suppose if it is 1.73 meters, your program should be able to print, 5 feet 8 inches
2. Kinetic Energy
Kinetic Energy equals 0.5 times mass (m) times square of velocity (v)
Write a function k_energy(m, v) under module KE.py. Import it to the main then write a function named kine_energy that accepts two arguments of mass and velocity.
Call your function twice to test the following parameters.
i) Object_A: mass = 230 kg, velocity = 12 m/sec
ii) Object_B: mass = 330 Kg, velocity = 11 m/sec
3. Future Value Calculation
Suppose you have a certain type of saving account that earns compound interest in your deposit. You can calculate your amount with formula,
F = P . (1 + i) ^ t
F = Future value of the account after a certain time period
P = current balance of your account
i = annual interest rate, percent must be divided by 100 in calculations
t = number of years
Write a function my_future_value (p, i, t) under module future_value.py. Import the module to the main. In main write a function calculate_future_value (PV, interest, time). Call this function twice to calculate the future value with arguments for present value, interest rate, and the number of months as below.
a) P = $25000, i = 14.37% and t = 10 years
b) P = $133000, i = 16.70% and t = 13 years
This assignment has been answered 5 times in private sessions.
© 2022 Codify Tutor. All rights reserved