Question: Program 3 (Homework) CSCI 251 Problem Statement Determine the number of days in a month (use numbers to represent the months) a. 31 days: January,
Program 3 (Homework) CSCI 251 Problem Statement Determine the number of days in a month (use numbers to represent the months) a. 31 days: January, March, May, July, August, October, December b. 30 days: Apr, June, September, November c. 28 or 29 days: February. Prompt for the year and using modulus determine if it is 28 or 29 days Input Data Output Data Getting Started Month (use number for the month, 1 for January, 2 for February, etc.) Days in that month 1. In Command Window type edit days yourLastName.m. You will be prompted that the file does not currently exist; select okay. MATLAB will open the file in the editor Include header comments formatted as shown below (you may want to copy and paste the header from a previous lab assignment and edit it). 2. % Course: CSCI 251, Section X % Student Name: Jane Doe % Student ID: 12345678 % Program 3 Homework % Due Date % In keeping with the Honor Code of UM, I have neither % given nor received assistance from anyone other than the instructor % Program Description: Algorithm 1. 2. 3. 4, Clear the Command Window and Workspace windows Prompt for month (use a number) Determine days in that month using switch statements Output number of days in the month, if the user enters 2 for February, then ask the user to input year, if it is a leap year (can be divisible by 4, but cannot be divisible by 100; if it is divisible by 100, it must also be divisible by 400 to be a leap year), then 29 days otherwise, 28 days (use if statements here). If the user's input is not 1-12, output Invalid month entered! Sample Output Enter in the month: 3 Days in that month: 31 Enter in the month: 2 Enter in the year: 2008 2008 is a leap year, days in February: 29
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
