Question: 2. Design a program that uses the equations provided below to calculate the weight, momentum and kinetic energy of a mass. Show the level of


2. Design a program that uses the equations provided below to calculate the weight, momentum and kinetic energy of a mass. Show the level of each value using the "bar chart" (created by the same number of % as the values of each variable). The mass and the velocity are user input with the following descriptions: The permitted input range for mass is 1.0 to 10 kg and the velocity of the mass must be from 1 to 5 m/s. You must keep asking if the user input anything outside this range. Please enter a mass between 1 and 10 kg: 5 Please enter a velocity between 1 and 5 m/s: 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Weight = 49 N. %%%%%%%%%%%%%%%%%%%% Momentum = 20 kg.m/s. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Kinetic Energy = 40 J. The highest value is weight. Do you wish to [r]etry or [q]uit? - Figure 1. Example of your task. Display a message indicating which of the three variables has the biggest magnitude. Each formula must be modularized. This means that you should create a block apart from the main function. Please take a look at the binary_search() function given as an example in homework 2. After the calculations ask the user is he/she wants to retry (use a string equal to r) or quit (use a string equal to q). If he/she select q, finish the program but if he/she selects r then repeat the whole code. If the user inputs something different please ask again. The formulas to use are: W = m *g M = m * v K.E. = 1/2(m * v2) Where m is mass, g is gravity, v is velocity. Also, W is weight, M is momentum and K.E. kinetic energy
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
