Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: Write code to display the number of days, given the month There is no time requirement, but Phase 1 should take an hour or

image text in transcribed

image text in transcribed

Objective: Write code to display the number of days, given the month There is no time requirement, but Phase 1 should take an hour or less and Phase 2 should take another 30 minutes to an hour. This is an optional challenge, but a couple of hours of your time could earn up to 5 points on the next exam. The problem is broken into phases. Phase 1 earns up to 3 points. Phase 2 earns an additional 2 points. Points will be added to Exam 2. Phase 1 (3 points): Implement the following program in MIPS: In the main program: . switch (month) o get month from the user o if the user enters 0, exit the program o if the month is not 1-12, print an error message and case 4: case 6: case 9: case 11: repeat o print the month and number of days as shown in the sample run * Write a function to determine the number of days by days-30; break; implementing a switch statement that is logically the same as shown in the box to the right, but in MIPS. case 1: case 3: case 5: case 7: case 8: case 10: case 12: Sample Phase 1 run (your wording can vary) Please enter the month 1 12, enter to quit: Number of days in month 1 is: 31 Please enter the month 1- 12, enter 0 to quit: 5 Number of days in month 5 is: 31 Please enter the month 1 12, enter 0 to quit: 12 Number of days in month 12 is: 3:1 Please enter the month 1-12, enter to quit: 13 Month must be between 1 and 12 Please enter the month 1 12, enter 0 to quit: -5 Month must be between 1 and 12 Please enter the month 1 12, enter to quit: 0 days 31; break; case 2: days = 28; break; Phase 2 (2 additional points): Instead of printing the number of the month, give the user the option to either print the number or print the 3-character abbreviation. Ask the user only once at the beginning of the program. Keep the user in a loop until they enter 1 or 2. Phase 2 sample run (Welcome message is optional): Welcome to the months and days program. Press 1 for month number, 2 for month abbreviation:2 Please enter the month 1 - 12, enter 0 to quit: 1 Number of days in month Jan is: 31 Please enter the month 1 - 12, enter 0 to quit: 5 Number of days in month May is: 31 Please enter the month 1 - 12, enter 0 to quit: 12 Number of days in month Dec is: 31 Please enter the month 1 -12, enter 0 to quit: 13 Month must be between 1 and 12 Please enter the month 1 -12, enter 0 to quit:0 program is finished running Upload your asm file to eLearning by Friday nooin This is an individual task, programs will be checked for similarity across sections. Objective: Write code to display the number of days, given the month There is no time requirement, but Phase 1 should take an hour or less and Phase 2 should take another 30 minutes to an hour. This is an optional challenge, but a couple of hours of your time could earn up to 5 points on the next exam. The problem is broken into phases. Phase 1 earns up to 3 points. Phase 2 earns an additional 2 points. Points will be added to Exam 2. Phase 1 (3 points): Implement the following program in MIPS: In the main program: . switch (month) o get month from the user o if the user enters 0, exit the program o if the month is not 1-12, print an error message and case 4: case 6: case 9: case 11: repeat o print the month and number of days as shown in the sample run * Write a function to determine the number of days by days-30; break; implementing a switch statement that is logically the same as shown in the box to the right, but in MIPS. case 1: case 3: case 5: case 7: case 8: case 10: case 12: Sample Phase 1 run (your wording can vary) Please enter the month 1 12, enter to quit: Number of days in month 1 is: 31 Please enter the month 1- 12, enter 0 to quit: 5 Number of days in month 5 is: 31 Please enter the month 1 12, enter 0 to quit: 12 Number of days in month 12 is: 3:1 Please enter the month 1-12, enter to quit: 13 Month must be between 1 and 12 Please enter the month 1 12, enter 0 to quit: -5 Month must be between 1 and 12 Please enter the month 1 12, enter to quit: 0 days 31; break; case 2: days = 28; break; Phase 2 (2 additional points): Instead of printing the number of the month, give the user the option to either print the number or print the 3-character abbreviation. Ask the user only once at the beginning of the program. Keep the user in a loop until they enter 1 or 2. Phase 2 sample run (Welcome message is optional): Welcome to the months and days program. Press 1 for month number, 2 for month abbreviation:2 Please enter the month 1 - 12, enter 0 to quit: 1 Number of days in month Jan is: 31 Please enter the month 1 - 12, enter 0 to quit: 5 Number of days in month May is: 31 Please enter the month 1 - 12, enter 0 to quit: 12 Number of days in month Dec is: 31 Please enter the month 1 -12, enter 0 to quit: 13 Month must be between 1 and 12 Please enter the month 1 -12, enter 0 to quit:0 program is finished running Upload your asm file to eLearning by Friday nooin This is an individual task, programs will be checked for similarity across sections

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

More Books

Students also viewed these Databases questions

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago