Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please i need help with this homework it's Matlab homework. please show all the work and the code itself. thank you 1. Use the disp
please i need help with this homework
1. Use the disp function to print the following line to the screen. It's not necessary to create a character variable; the string can go directly in the call to disp. To be or not to be. 2. Repeat problem 1, but use fprintf instead of disp. As in problem 1, there's no need to create a character variable; the string can go directly in the fprintf statement. 3. Use the input function to prompt the user for the number of students in a class, storing the input in the variable nstudents. Use the disp function to print the value to the screen in the format shown. Here, "n" represents the number that was input. There are n students in the class. 4. Repeat problem 3, but use fprintf instead of disp. Don't convert the number to an character string; print it using the appropriate format for an integer. 5. Use the input function to prompt the user for the make of his/her car, storing the result in the variable mycar. Use the 's' argument to indicate that it's a character string, not a number, that is to be input. Use the disp function to print it to the screen in the format shown. Here, "make" represents the name of the make that was input. My car is a make. 6. Repeat problem 5, but use fprintf instead of disp. Use the appropriate format specifier to print a character string. 7. Use the input function to prompt the user for the length of a box, and another call to input to prompt for the width of the box, where the inputs will be floating-point numbers (will have decimal points). Use fprintf to print the following to the screen, where "length" and "width" represent the values that were input. Print the values using 1 decimal place for both the length and width. The box is length by width. viruses. Unless you need to edit, it's safer to stay in Protected View Enable Editing Extra Credit Problem Write a program to calculate geometric information for a cone of specified radius and height, using the following steps. 1. Prompt the user for the radius of the base of the cone using the input function. Don't forget the semicolon at the end of the line, otherwise the value will echo to the screen. 2. Prompt the user for the height of the cone using the input function. 3. Calculate the following parameters. Note that the built-in variable pi contains the value of T: a. Area of base = 7tr2 b. Perimeter of base = 2tr C. Area of side = Trvr2 + h2 d. Total surface area = area of base plus area of side e. Volume = nr 4. Print all 5 of these values to the screen using fprintf in the format shown below. Make sure that the decimal points are aligned vertically. Test your program with a radius of 5 and a height of 8. The correct values for these inputs are shown below. end area perimeter side area total area volume 78.54 31.42 148.19 226.73 209.44 it's Matlab homework.
please show all the work and the code itself.
thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started