Im wondering if anyone can point me in the right direction with this problem. I am just learning functions and I dont even know where to start.
Any help would be greatly appreciated
Problem
How much you can expect to earn the rest of your life depends, among other things, on what level of college degree you have, your gender, and your age when you graduate. Assuming you work full-time until retirement at age 65, your lifetime earnings can be estimated by:
LTE = C * (65 – age at graduation), where C is found in the table below and in the file “cTable.mat”:
Male Female
BS 53,102 37,304
MS 71,071 44,567
Phd 86,436 62,169
(This table is an average for all college majors. Engineers earn more, and the male/female gap is much smaller for engineers.)
Using nested switch/case structures, write an m-file function that returns the estimated lifetime earnings of a user. Name your function: LastnameFirstinitial_LTE.m. The function should have 3 inputs. The first input should be the user’s age at graduation in years. The second input should be the user’s gender as a string (either ‘male’ or ‘female’). The third input should be the user’s college degree as a string (either ‘BS’, ‘MS’, or ‘PhD’). If the user provides an invalid string for inputs two or three, ‘improper input’ should be displayed in the command window and the output should be an empty value.
The file “cTable.mat” is a matrix that contains the values for C shown in the above table. In your function, load this file to your workspace and use these values in the calculation of LTE. C must come from this matrix and should not be defined manually within your function.
This post was edited by DeVaginey on Feb 3 2013 12:57am