Question
Write a program in MATLAB that processes a series of employees to determine the days until/since a given employees birthday as follows: To populate the
Write a program in MATLAB that processes a series of employees to determine the days until/since a given employees birthday as follows:
To populate the employees' data, read in a comma separated file containing First Name, Last Name, Birthday Month, Birthday Day, and Salary. Use the file uploaded in Loud Cloud as an example.
Build up an array of employee records (i.e., structures) where each record contains the employee's first name, last name, birthday (stored as an integer representing days from January 1st), and salary.
Create a function that takes two numbers (month and day) as input and returns a single number (days since January 1st). This function will be used to "translate" the birthday format from that of the input file to that required for the data structures.
Create an array containing 12 values in which each number represents the days in each month of the year (i.e., 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31).
Subtract 1 from the input month and iterate over the array, adding in the value until you have the days in (month-1) months.
Add to this the number of the birthday day.
Prompt the user to supply an employees first name. Using the result, search through the array of structures to find the requested employee. Display the number of days between the current date and the employees birthday. Note that this will be a negative number if the employees birthday has already passed
The CSV table is below:.
Donald | Trump | 6 | 14 | 400000 |
Mickey | Mouse | 11 | 18 | 10000 |
Ada | Lovelace | 12 | 10 | 5000 |
Justin | Bieber | 3 | 1 | 125000 |
Benjamin | Franklin | 1 | 17 | 15000 |
Angela | Merkel | 7 | 17 | 234400 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started