Question: (a) Write a script floorplanner.m that allows the user to build their own floor plan utilizing 3 shapes: rectangle, circle, and triangle. The script should


(a) Write a script floorplanner.m that allows the user to build their own floor plan utilizing 3 shapes: rectangle, circle, and triangle. The script should ask the user for the location of where each shape would be (i.e. 'Enter the r center coordinate for the circle") and save these values into variables. Then, these variables should be fed into the functions you wrote above to plot the three shapes. Things to consider: . Do not overlap shapes The floor plan must have all three shapes plotted once (no multiples) . Try to keep your floor dimensions in a 15x15 grid Floor Plan 9 8 7 6 5 4 3 2 1 -1 5 6 7 8 9 Figure 3: Floor Plan (no overlap) Last but not least, in your script, calculate the total area of all three shapes and display the total area to the user. You can use disp() or fprintf(. Your script should call most, if not all of the functions that you've written to compute areas and plot shapes. Below is a quick introduction to the fprintf() function: Mfprintf is another MATLAB built-in function that takes in a string using single quotes. %The character is known as the newline character to move the print/cursor to a new line fprintf('This will print a sentence onto the Command Window "); >>This will print a sentence onto the Command Window %To print a string with a number, use the %d token to format an integer. %d below will be Kreplaced with whatever integer value is stored in the variable num_of_apples num_of_apples - 5; fprintf('There are %d apples in the fruit basket ', num_of_apples); >>There are 5 apples in the fruit basket %To print a decimal value (also known as a floating point number in computer programming vernacular) %use the %f token. Once again, the %.2f will be replaced with the floating point value stored %in the variable total area. The .2 specifies how many decimal places to the right to print. width - 57.28; height - 2; total area = width * height; fprintf("The total area is %.2f ', total_area) >>The total area is 114.56
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
