Question: #8915

Home Work 31 nad 32 Complete Solution

Home Work 3.1

1. Use execution control statements to sort an array in ascending order which is entered by the user

2. Now sort the same array using MATLAB’s inbuilt command sort()

Hints for HW3.1:

Use input() to get the array from the user Use if, if-elseif, for and other statements to develop an algorithm following the flow mentioned below

Home Work 3.2

1. Write a user-written function that will calculate volume and area of a cylinder for dimensions, the height and the radius provided by the user

2. For the cylinder in the Q1 if we are required to paint the complete cylinder find how much paint is required

3. If the cylinder in Q1 is made up of Aluminum, find how much would be the material cost involved.

4. Now print all the results/details using ‘fprintf()’

Hints for HW3.2:

Use input() to get height and radius of the cylinder
Use geometrical formulas to get volume(base_area*height) and surface area of the cylinder(base_circumference*height+base_area*2)
Find rate of Aluminum from online resources(Google,etc)eg. 0.85$/lb
Find mass of the cylinder using density of Aluminum and use the rate you found
Use fprintf() to print a statement which gives all the details that were asked in the HW3.2 including the specifications of the cylinder
Get array(input) from user
Get number of rows and columns in the array
Start from the first number(first row, first column)
Compare it with all the elements in the array
If selected number is greater than any of the next numbers, swap their location
Select the next number and repeat process for all locations in the array

Solution: #8943

Home Work 31 nad 32 Complete Solution

This Tutorial is rated A+ p...
Tutormaster
Rating: A+ Purchased: 11 x Posted By: Vikas
Comments
Posted by: Vikas

Online Users