choice=menu('Menu','Cylinder','Circle','Rectangle');
fprintf('You have chosen option %d\n',choice)
switch choice
case 1
cyl()
case 2
cir()
case 3
rec()
end
function cyl()
r=input('Enter radius of the cylinder: ');
h=input('Enter height of the cylinder:');
area=2*pi*r*h+2*pi*r*r;
fprintf('The area is %.2f\n',area)
end
function cir()
r=input('Enter radius of the circle: ');
area=pi*r*r;
fprintf('The area is %.2f\n',area)
end
function rec()
l=input('Enter the length: ');
w=input('Enter the width: ');
fprintf('The area is %.2f\n',l*w);
end

matlab The Homework should be submitted as a script (.m) file Write a script areaMenu that...
Write a matlab script(using only matlab) for this.
Write a script to solve the following problem: Ask the user for the length and the width of a rectangle. These need to be passed to a function. The function is to calculate and return the area and the perimeter of the rectangle. The area is the length times the width and the perimeter is 2 times the length and 2 times the width. Make sure to suppress all output from the...
can anyone help me figure out how fo write matlab code for
these problems?
BME 2013 Spring 2019 Exam 3 Matlab Review Sheet 1. Given the vector of patient body temperatures T (98.6, 102, 101, 99,98.9, 102.1, 100.3, 101.2, 98.4 97.6, 100] use conditional statements and loops to write a program that determines and displays (using the fprintf function) the number of patients with a fever and patients without a fever. The program must ask the user to input the...
JAVA Code Requried Copy the file java included below. This program will compile, but, when you run it, it doesn’t appear to do anything except wait. That is because it is waiting for user input, but the user doesn’t have the menu to choose from yet. We will need to create this. Below the main method, but in the Geometry class, create a static method called printMenu that has no parameter list and does not return a value. It will...
Menu-driven programs will display the menu options to the user and then prompt them for a menu choice. This program will display the following menu in the following format: Calculator Options: Calculate the area of a circle Calculate the area of a rectangle Calculate the area of a triangle Calculate the area of a trapezoid Calculate the area of a sphere Exit Enter your choice (1-6) Once the user enters a choice for the menu, the program should use a...
MATLAB Programming Question Create an M-file (script) that prompts the user to enter a value of x and then calculates the value of sin (x). This is my script: x=input('enter value of x in radians'); y=sin(x); And I get the error message, Warning: Function sin has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. How would I fix this?
Write a script in MATLAB that prompts the user to do a, b, & c. a.)script that prompts the user to enter the day of the week using the input function. If the information the user enters is equal to “Saturday” or “Sunday”, display “have a nice weekend” in the Command Window. Otherwise, display “Good luck in your class lectures and your studies.” b.)script that prompts the user to input the following array by providing an example in the prompt:...
Project Objectives: To develop ability to write void and value returning methods and to call them -- Introduction: Methods are commonly used to break a problem down into small manageable pieces. A large task can be broken down into smaller tasks (methods) that contain the details of how to complete that small task. The larger problem is then solved by implementing the smaller tasks (calling the methods) in the correct order. This also allows for efficiencies, since the method can...
(PYTHON) Write a program that displays the following menu:. , Write Algorithm for Code Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1 - 4): If the user enters 1, the program should ask for the radius of the circle and then display its area. If the user enters 2, the program should ask for the length and width of...
Pure Abstract Base Class Project. Define a class called BasicShape which will be a pure abstract class. The class will have one protected data member that will be a double called area. It will provide a function called getArea which should return the value of the data member area. It will also provide a function called calcArea which must be a pure virtual function. Define a class called Circle. It should be a derived class of the BasicShape class. This...