The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Need a script for a lab. I can't seem to figure out how to do it successfully on my own.
Sottile – Spring 2016CMPSC 200 Programming for Engineers with MATLABLab 6Instructions:Create a single script (.m file) to solve this problem. Unless directed otherwise, use meaningfulvariable names for each variable; do not use the default variableansto store your results.Suppress your output for every calculation or allocation with a semi-colon; you may only useprint commands to print output.Please remember to follow the programming style sheet on ANGEL. When complete, pleasesubmit your code to the dropbox on ANGEL; the graders will run it to view your output. Nameyour file like this:username_lab6.m(example:bjs5332_lab6.m). Your submissionmust be a single .m file.Problem 1(10 points)Permanent employees are generally classified under two different compensation schemes: wagepayroll (“wage”) employees, and salaried employees. Wage employees receive an hourly rate forthe time they work, and are eligible for overtime on the time they work over the specified “full-time hours”. Salaried employees receive a fixed paycheck regardless of the number of hoursworked; as such, they are ineligible for overtime.Consider a company that compensates their wage employees as such:Full-Time Hours: 40Normal Hourly Rate: $23/hourOvertime Multiplier: 1.5 (for time over 40 hours)Write a program that a payroll clerk could use to figure out the gross pay for their employees.Calculate the pay (printed only to 2 decimal places) for wage employees; include a notification ifa wage employee will be receiving overtime pay. Since a salaried employee’s pay is fixed, therewould be no reason to need to calculate it – a simple statement stating such to the user observingthis fact will suffice. Prompt the user with a menu to choose “Wage Employee” or “SalariedEmployee,” then use a switch to examine each of those cases as appropriate. Try to mirror thesample results I’ve included on the second page of this document.Emulate the behavior of ado whileloop in MATLAB to ensure the program runs at least once;the program should run until the user enters a sentinel value of−1. Only enter numbers whenyou check if the program should terminate.Hints: (1) For wage employees, overtime only applies to the time worked over the full-timehours. (2)do whileloops are unavailable in MATLAB, but we discussed how to emulate theirbehavior in Lecture 16 usingwhileloops. (3) Only enter numbers to check if the loop shouldstop, otherwise the program will yield errors when you check the stopping criteria. (4) Youmight find it useful to nest anifstatement into one of your switch cases.
Sottile – Spring 2016CMPSC 200 Programming for Engineers with MATLABProgramming Style ConventionMany different organizations maintain standards for code documentation – the purpose of usinga style convention in this class is twofold: 1) to get you use to documenting your code to a givenstandard, and 2) to facilitate grading a large number of programs.Note: The easiest way to line up lines is to tab over with the tab key.Comments at the top of your programPick your favorite format between Option 1 and 2 (both are acceptable):Option 1:% Programmer:Your Name% Section:1 (enter your correct section number)% Lab/Project: 1 (enter the correct type and number)% Date:September 3, 2014 (update with correct date)% Description: A description of what the program does; limit this to just%the highlights – only a few sentencesOption 2:%{Programmer:Your NameSection:1 (enter your correct section number)Lab/Project: 1 (enter the correct type and number)Date:September 3, 2014 (update with correct date)Description: A description of what the program does; limit this to justthe highlights - only a few sentences.%}Variables and ConstantsEach variable or constant should be allocated one per line, so don’t allocate multiple variables onone line of code. When you declare a constant or a variable, include a comment with the variableor constant’s units and what it represents; include empty braces for variables that aredimensionless. For example:g = 9.81;% [m/s^2] gravitational acceleration at sea levelmu_static = 0.5;% [ ] coefficient of static frictionConstants should be allocated at the top of a program, underneath the comments at the top of theprogram and theclcandclearstatements. Listing them together forms a “data dictionary” ofconstants that can be easily seen by the programmer and anyone that later has to view your code.
Attachments:
-----------