Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

Students also viewed these Databases questions

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago