Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In-class Exercise 2. Create the four functions described below. Follow the custo

ID: 3911599 • Letter: I

Question

In-class Exercise 2. Create the four functions described below. Follow the custom function convention described early. Provide an example of each function functioning a) Write a function that takes in current and voltage as input arguments, and outputs power. b) Write a function that asks the user to input their age and then outputs the users age in dog years (1 human year: 7 dog years). This function should have no input arguments. c) Write a function that takes the radius and height of a cylinder as input arguments, displays the volume of the cylinder, but does NOT produce an output. d) Write a function that takes a user input number as an input argument. The function should output the sum of the user input and a randomly generated number. (hint: 'help rand')

Explanation / Answer

NOTE:- Please maintain the tabs properly; otherwise it will give error

function pow_res = power_c_v(current,voltage)
pow_res=current*voltage;
end

function dog_year = cal_dog_years()
human_years = input("enter your age ")
dog_year = human_years * 7;
end

function volume_cylinder(radius,height)
vol_cyc = pi * radius * radius * height
disp("volume of cylinder =" + vol_cyc)
end

function sum_rand = sum_with_random(num)
sum_rand = num + rand(1)
end