Question: Answer with MATLAB coding with steps please Procedure You do not have to submit any zip files to Canvas or PDFs to Gradescope for this


Answer with MATLAB coding with steps please
Procedure You do not have to submit any zip files to Canvas or PDFs to Gradescope for this assignment. Before submitting your lab assignment, add your name, student ID, and lab time at the top of your code. Failure to do so will result in a penalty. It is recommended that you complete the assignment in the MATLAB application first, then copy and paste your script to the submission box below. . Look at Lec3_2ForVsWhile.m to see an example of changing a for loop into a while loop Starting with your problem one lab script (no plotting) will probably be easier than starting with your lab script from problem two. Replace the for k= part of the loop with a while loop o What is your stopping condition? You will need to make your own k variable, and increment it at the bottom of the loop as shown in Lec3_2ForVsWhile.m Remember control-c in the command window if your program doesn't stop After assessing the total number of cups, at least 75, replace the value 75 with the following: randi([75,300],1,1). The code will generate a random integer, used for assessing your code. Sum up bottles until you are over 75. How many days/loops are needed? Print out bottles on the wall and total until you reach at least 75. . Step by Step Instructions: Look at Lec3_2ForVsWhile.m to see an example of changing a for loop into a while loop Starting with your problem one lab script (no plotting) will probably be easier than starting with your lab script from problem two. Replace the for k= ... part of the loop with a while loop o What is your stopping condition? You will need to make your own k variable, and increment it at the bottom of the loop as shown in Lec3_2ForVsWhile.m Remember control-c in the command window if your program doesn't stop Self-check: 1 cups of tea on the shelf, total 1 2 cups of tea on the shelf, total 3 3 cups of tea on the shelf, total 6 4 cups of tea on the shelf, total 10 5 cups of tea on the shelf, total 15 6 cups of tea on the shelf, total 21 7 cups of tea on the shelf, total 28 8 cups of tea on the shelf, total 36 9 cups of tea on the shelf, total 45 10 cups of tea on the shelf, total 55 11 cups of tea on the shelf, total 66 12 cups of tea on the shelf, total 78 Total number of cups is: 78 after 12 loops EVY % NOTE: Do not include any clear statements when submitting the assignment 2 % NOTE: Use variable, totalCups, for total number of cups 3 % NOTE: Use k as counting variable % NOTE: Replace the value 75, for at least 75 cups, with the least_num_Cups variable 5 least_num_Cups = randi([75, 300], 1,1); 4 8 6 7 while totalCups = % Change this code to reflect change in totalCups fprintf('%0.0f cups of tea on the shelf, total %0.0f ',); k = ; % Change code to update k 11 end 9 10 13 k_complete = ; % Change variable to determine k value when totalCups requirement is met
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
