Write a matlab program that will allow the user to find


Write a MATLAB program that will allow the user to find area and circumference of a circle. Selections and data entry will be done by presenting the user with a menu (using menu function) and provide her/him with the following choices: 

? Enter the radius 

? Display the area 

? Display the circumference 

? Exit 

Other Requirements: 

? Selecting choice 2 or 3 before entering the radius will result in an error message. The program will terminate only when Exit has been selected ? 

Calculations will be done by functions. 

Function circleInfo() will ask for the radius and will return it. 

Function circleArea() will accept a parameter, the radius, and returns the area. 

Function circleCircum() will accept a parameter, the radius, and returns the circumference. 

? Results are displayed with 2 decimal place accuracy. 

Partial Help with the menu: 

flag =0; 

%Calculation 

while (1) 

choice=menu('Circle and Cylinder', 'Enter the radius','Display the area', 'Display the circumference','Exit'); 

switch(choice) 

case 1 

r=circleInfo(); 

flag=1; 

case 2 if (flag==0) 

disp('you need to enter the radius first'); 

else area=circleArea(r); 

end 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a matlab program that will allow the user to find
Reference No:- TGS01083787

Expected delivery within 24 Hours