I have a lab due tomorrow and am very confused, help on everything would be much appreciated, apologies for the huge quantity of stuff. Thanks
ENCMP 100-Computer Programming for Engineers Page 1 of 7 ENCMP 100 - Computer Programming for Engineers Assignment #3 Due: Friday, Mar, 5 2021 at 6:00pm MST Objective This assignment is designed to provide you with practice using repetition loops structures in your program Loops allow a set of statement(s) to be repcaled. There are basically two lypes of looping in programming, counted loops and conditional loops. A counted loop allows statement(s) to be repeated for a known number of times, while for the conditional loop, the number of times for the slatements to be repcalcd is not known in advance, but depends on a specificd condition in the loop statement Marking Scheme You will get a total of 100 points for completing the following: TASK Part A: Correct display of results Part B: Correct display of results Quality of code (25 points for each part) TOTAL POINTS 25 25 50 50 Points for Quality of Code: Complete file header Design (appropriate use and naming of variables Comments in the code Layout (indentation spacing) Did you follow filename naming convention . . Submission Filename naming convention Assign3A_
.m Ex. CCID or email: jmac filename for assignment il is Assign3A_jmac.m Submit only your .m file under Assignment 3A and 3B in your Class:Moodle account. The assignment is due Friday, Mar. 5 2021 at 6:00pm MST Please thoroughly test your code to ensure functionality. . . ENCMP 100-Computer Programming for Engineers Page 2 of 7 Problem and Program Details: With the help of an RESP(Registered Education Savings Plan), a parent can start putting aside money for a child's post-secondary education. Suppose that a young couple deposits $2,000 10 start the savings plan, and cach month thereafter they contribute $200. Assume that a fixed interested rate of 6% per year compounded monthly is applied. Each month the balance increases according to the following formula: New balance Old balance+ (Old balance * Monthly interest rate) + Monthly contribution (1) Since the university tuition fee increases over the years, you are asked to further analyze whether the saving is enough to cover the tuition fee for a 4-year study program. You will help them analyze this for 3 different types University programs: Arts, Science, and Enginccring, for which the average tuition fees in the current year are as follows: $6000, $6500, and $7000 respectively. The predicted average percentage of tuition increase each year is 5.75%. Each year the new fee due to the annual increase is calculated as follows: New cost = Old cost + (Old cost * Annual increase rate) (2) Part A: In this part, you are asked to calculate the balance of the ing account in each month over 18 ycars, so the total saving by the end of the 18 year is known. Then calculate the predicted total tuition fee by the 18th year, which should be the total fee over a 4-year university program (i.e. from year 19 lo ycar 22). A for loop can be used for the above calculations. Finally, by comparing the total savings and the predicted total tuition fee. determine whether or not the saviny goal is achieved by the end of the 18 year. Steps: 1. Calculate the monthly balance of the savings plan for the next 18 years, based on the formula in cquation (1). Save the amount in a vector or an array. 2. Calculate the predicted tuition fee per year for the next 22 years, and then add up the fees over the last 4 college years (from the year 19 to year 22) to get the predicted total education cost for a 4-year program. ENCMP 100-Computer Programming for Engineers Page 3 of 7 3. Compare the savings plan balance and the cost calculated from the step 2. Are the parents saving enough? Print the answer in the command window. To visualize the result, you are also asked to plot the annual savings with respect to the number of years, plot a horizontal line (threshold) indicating the total tuition fee on the same plot. Obviously, if the saving plot goes above this threshold at year 18, then the objective of the saving plan is achieved; otherwise, the objective is not achieved, the customer may choose to increase the monthly saving amount. Output To summarize, in this Pait, your program needs to generate the following outputs: An answer to whether or not the parents are saving enough, in the command window A plot showing both the plot of the annual savings vs. the years, and the threshold line (for the cost). Please label your plot properly. Sample Screenshots should look similar to the ones included. If it is successful ... If it is not successful... Command Window Selact 3 program: 1. Arts. 3. Science: 3. Engineering: At the end of 10 years you will have saved $ The cost of a 4 year college tuition fee is S Congratulations!!!! You have saved enough. fx >> Command Window Select a program: 1. Arts; 2. Science: 3. Buy inercing AL by end of 18 years you w.21 lave savedi 5 The cost of a 4-y-d Lulleye tuition les s $ he waving is SWLL. >> X Figure! File Edit View Insert Tools Derkoce Window Heb als - Ga na Cong wings vs Tonton Figure File Edt View set Tools Leitop Window Help 3d05 Cclege Savings vs. lucion tee 23. PS 2 4 8 10 12 14 16 121 10 12 12 14 1A 16 8 Yea Year Note: The lines will cross The lines do not cross ENCMP 100-Computer Programming for Engineers Page 4 of 7 Assignment 3 - Part A Submission: For part A of this assignment, please submit your solution to eClass under Assigunent 3A. With the following naming convention: Assign3A_.mn Ex. CCID jmac filename will be Assign3Ajmaci Part B: In part A, the monthly contribution of $200 is used in the calculation. For a 'smarter' savings plan, we may ask: How much does the couple need to put on a monthly basis in order to achieve the goal of saving enough for the predicted 4-year tuition fee? In this pat, you are asked to help the customer determine the minimum monthly saving amount in order to reach the goal for a given academic program. Assume that the saine first payinent $2,000 is used as in Pait A. Based on the for loop structure constructed in part A, a condition while loop may be added as an outer loop 1. Assume that the monthly payment increases from 50 dollars with an increment of $10 each time and repeat the calculations in Pat A, until the saving goal is reached. For this, the students are asked to use a while loop. 2. Save the minimum monthly contribution and print it on the command window. Output For this pait, your program should generate the following output Print out the minimum monthly contribution for the savings plan with respect to each chosen academic program ENCMP 100-Computer Programming for Engineers Page 5 of 7 Your output should look like the example screenshots below. For Arts: Command Window Select a program: 1. Arts; 2. Science; 3. Engineering: 1 The 4-year tuition fee is $ 71536.32 You will need to save $ 180.00 each month to reach the goal >> | For Science: Command Window Select a program: 1. Arts; 2. Science; 3. Engineering: 2 The 4-year tuition fee 12 $ 77497.68 You will need to save $ 190.00 each month to reach the goal For Engineering: Command Window Select a program: 1. Arta; 2. Science; 3. Engineering: 3 The 4-year tuition fee is $ 83459.04 You will need to save $ 210.00 each month to reach the goal fx >> ENCMP 100-Computer Programming for Engineers Page 6 of 7 Assignment 3 - Part B Submission: For part B of this assignent, please subinit your solution to eClass under Assignment 3B. With the following naming convention: Assign3B Ex. CCID: jmac filename will be Assign3B jmac.m Code Requirements 1) You must use the fprintf function to display your results to the command window for assignunent #3 for parts A and B. 2) You must use two types of loops (for and while loop) in your solution for part B of this assigninent 3) Do not use the menu function to accomplish this assignunent. ENCMP 100-Computer Programming for Engineers Page 7 of 7 Hints 1. Before you even begin to write out any MATLAB code, sit down and sketch out your program design in abbreviated English This kind of high-level program design is called pseudo code (Please refer to page 59-60 of the course notes). 2. At the beginning of the program, you can use an input statement together with a switch/case statement for selecting from 3 academic programs, and assigning the initial tuition fee with respect to the chosen program. 3. Use the built-in MATLAB functions, such as sum, plot, and fprintf 4. Please remember to include your header at the top of your *m file. Copyright (c) 2020, Dileepan Joseph All rights reserved. Student name: Student CCID: Others: To avoid plagiarism, list the names of persons, whose code, ideas, images, or data are used in any derivative work. To avoid cheating, list the names of persons, other than your course or lab instructor who provided compositional assistance. After each name, including the student's, enter in parentheses an estimate of the person's contributions in percent. Without these numbers, which add to 100%, follow-up questions will be asked. For an unknown person, e.g., an anonymous online source that should be avoided, enter a code name in uppercase, e.g.. SAURON, and email the lab instructor prior to submission with the corresponding URL. clear; $deletes all the saved variables cle; clears the Command window ENCMP 100-Computer Programming for Engineers Page 1 of 7 ENCMP 100 - Computer Programming for Engineers Assignment #3 Due: Friday, Mar, 5 2021 at 6:00pm MST Objective This assignment is designed to provide you with practice using repetition loops structures in your program Loops allow a set of statement(s) to be repcaled. There are basically two lypes of looping in programming, counted loops and conditional loops. A counted loop allows statement(s) to be repeated for a known number of times, while for the conditional loop, the number of times for the slatements to be repcalcd is not known in advance, but depends on a specificd condition in the loop statement Marking Scheme You will get a total of 100 points for completing the following: TASK Part A: Correct display of results Part B: Correct display of results Quality of code (25 points for each part) TOTAL POINTS 25 25 50 50 Points for Quality of Code: Complete file header Design (appropriate use and naming of variables Comments in the code Layout (indentation spacing) Did you follow filename naming convention . . Submission Filename naming convention Assign3A_.m Ex. CCID or email: jmac filename for assignment il is Assign3A_jmac.m Submit only your .m file under Assignment 3A and 3B in your Class:Moodle account. The assignment is due Friday, Mar. 5 2021 at 6:00pm MST Please thoroughly test your code to ensure functionality. . . ENCMP 100-Computer Programming for Engineers Page 2 of 7 Problem and Program Details: With the help of an RESP(Registered Education Savings Plan), a parent can start putting aside money for a child's post-secondary education. Suppose that a young couple deposits $2,000 10 start the savings plan, and cach month thereafter they contribute $200. Assume that a fixed interested rate of 6% per year compounded monthly is applied. Each month the balance increases according to the following formula: New balance Old balance+ (Old balance * Monthly interest rate) + Monthly contribution (1) Since the university tuition fee increases over the years, you are asked to further analyze whether the saving is enough to cover the tuition fee for a 4-year study program. You will help them analyze this for 3 different types University programs: Arts, Science, and Enginccring, for which the average tuition fees in the current year are as follows: $6000, $6500, and $7000 respectively. The predicted average percentage of tuition increase each year is 5.75%. Each year the new fee due to the annual increase is calculated as follows: New cost = Old cost + (Old cost * Annual increase rate) (2) Part A: In this part, you are asked to calculate the balance of the ing account in each month over 18 ycars, so the total saving by the end of the 18 year is known. Then calculate the predicted total tuition fee by the 18th year, which should be the total fee over a 4-year university program (i.e. from year 19 lo ycar 22). A for loop can be used for the above calculations. Finally, by comparing the total savings and the predicted total tuition fee. determine whether or not the saviny goal is achieved by the end of the 18 year. Steps: 1. Calculate the monthly balance of the savings plan for the next 18 years, based on the formula in cquation (1). Save the amount in a vector or an array. 2. Calculate the predicted tuition fee per year for the next 22 years, and then add up the fees over the last 4 college years (from the year 19 to year 22) to get the predicted total education cost for a 4-year program. ENCMP 100-Computer Programming for Engineers Page 3 of 7 3. Compare the savings plan balance and the cost calculated from the step 2. Are the parents saving enough? Print the answer in the command window. To visualize the result, you are also asked to plot the annual savings with respect to the number of years, plot a horizontal line (threshold) indicating the total tuition fee on the same plot. Obviously, if the saving plot goes above this threshold at year 18, then the objective of the saving plan is achieved; otherwise, the objective is not achieved, the customer may choose to increase the monthly saving amount. Output To summarize, in this Pait, your program needs to generate the following outputs: An answer to whether or not the parents are saving enough, in the command window A plot showing both the plot of the annual savings vs. the years, and the threshold line (for the cost). Please label your plot properly. Sample Screenshots should look similar to the ones included. If it is successful ... If it is not successful... Command Window Selact 3 program: 1. Arts. 3. Science: 3. Engineering: At the end of 10 years you will have saved $ The cost of a 4 year college tuition fee is S Congratulations!!!! You have saved enough. fx >> Command Window Select a program: 1. Arts; 2. Science: 3. Buy inercing AL by end of 18 years you w.21 lave savedi 5 The cost of a 4-y-d Lulleye tuition les s $ he waving is SWLL. >> X Figure! File Edit View Insert Tools Derkoce Window Heb als - Ga na Cong wings vs Tonton Figure File Edt View set Tools Leitop Window Help 3d05 Cclege Savings vs. lucion tee 23. PS 2 4 8 10 12 14 16 121 10 12 12 14 1A 16 8 Yea Year Note: The lines will cross The lines do not cross ENCMP 100-Computer Programming for Engineers Page 4 of 7 Assignment 3 - Part A Submission: For part A of this assignment, please submit your solution to eClass under Assigunent 3A. With the following naming convention: Assign3A_.mn Ex. CCID jmac filename will be Assign3Ajmaci Part B: In part A, the monthly contribution of $200 is used in the calculation. For a 'smarter' savings plan, we may ask: How much does the couple need to put on a monthly basis in order to achieve the goal of saving enough for the predicted 4-year tuition fee? In this pat, you are asked to help the customer determine the minimum monthly saving amount in order to reach the goal for a given academic program. Assume that the saine first payinent $2,000 is used as in Pait A. Based on the for loop structure constructed in part A, a condition while loop may be added as an outer loop 1. Assume that the monthly payment increases from 50 dollars with an increment of $10 each time and repeat the calculations in Pat A, until the saving goal is reached. For this, the students are asked to use a while loop. 2. Save the minimum monthly contribution and print it on the command window. Output For this pait, your program should generate the following output Print out the minimum monthly contribution for the savings plan with respect to each chosen academic program ENCMP 100-Computer Programming for Engineers Page 5 of 7 Your output should look like the example screenshots below. For Arts: Command Window Select a program: 1. Arts; 2. Science; 3. Engineering: 1 The 4-year tuition fee is $ 71536.32 You will need to save $ 180.00 each month to reach the goal >> | For Science: Command Window Select a program: 1. Arts; 2. Science; 3. Engineering: 2 The 4-year tuition fee 12 $ 77497.68 You will need to save $ 190.00 each month to reach the goal For Engineering: Command Window Select a program: 1. Arta; 2. Science; 3. Engineering: 3 The 4-year tuition fee is $ 83459.04 You will need to save $ 210.00 each month to reach the goal fx >> ENCMP 100-Computer Programming for Engineers Page 6 of 7 Assignment 3 - Part B Submission: For part B of this assignent, please subinit your solution to eClass under Assignment 3B. With the following naming convention: Assign3B Ex. CCID: jmac filename will be Assign3B jmac.m Code Requirements 1) You must use the fprintf function to display your results to the command window for assignunent #3 for parts A and B. 2) You must use two types of loops (for and while loop) in your solution for part B of this assigninent 3) Do not use the menu function to accomplish this assignunent. ENCMP 100-Computer Programming for Engineers Page 7 of 7 Hints 1. Before you even begin to write out any MATLAB code, sit down and sketch out your program design in abbreviated English This kind of high-level program design is called pseudo code (Please refer to page 59-60 of the course notes). 2. At the beginning of the program, you can use an input statement together with a switch/case statement for selecting from 3 academic programs, and assigning the initial tuition fee with respect to the chosen program. 3. Use the built-in MATLAB functions, such as sum, plot, and fprintf 4. Please remember to include your header at the top of your *m file. Copyright (c) 2020, Dileepan Joseph All rights reserved. Student name: Student CCID: Others: To avoid plagiarism, list the names of persons, whose code, ideas, images, or data are used in any derivative work. To avoid cheating, list the names of persons, other than your course or lab instructor who provided compositional assistance. After each name, including the student's, enter in parentheses an estimate of the person's contributions in percent. Without these numbers, which add to 100%, follow-up questions will be asked. For an unknown person, e.g., an anonymous online source that should be avoided, enter a code name in uppercase, e.g.. SAURON, and email the lab instructor prior to submission with the corresponding URL. clear; $deletes all the saved variables cle; clears the Command window