Tags:
tag this topic
create new tag
view all tags
---+ Methods: A month's calendar a better way: Fall 2023 ---++ Learning Objective(s) 1 Learn about methods 1 Understand some benefits of abstraction ---++ Overview of the Program For this lab you adapt the previous program that displays the calendar of a month to use methods ---++ Specifics * The program should be called *DisplayMonthMethod* * Input should be the year, followed by the month, and then the day it starts on (with Sunday being 0 and Saturday being 6). Only valid values should be allowed. The year can range from 1500 to 5000 * The name of the month should be displayed first (you may choose the language) * You must account for leap year. Note: leap year is not a simple as every four leaps. Research the details. * The month days should line up nicely. * You should have the following methods: * *getValid*: This is sent a low value, a high value, a message, and the keyboard. It returns an integer within that range. It continues to get an integer from the user (displaying the message each time until it is give a proper value) * *displayMonth*: This method is sent the year, month, and starting day. It does not return a value but is responsible to see that the entire month is properly displayed. It should have *NO* print or println statements itself. It also should have no selection statement. It can contain one loop. * *getNumDays*: This method is sent a year and a month and returns the number of days in that month. * *displayMonthTitle*: This method is sent a month and outputs it title (i.e. May if sent 5) * *displaySpaces*: This method is sent an integer and outputs 3 times that many spaces on one line. It does *NOT* output a new line. * *displayWeek*: This method is sent a number representing the first and last days of the week. It does not return anything. It displays those days on a line and outputs the new line at the end ---++Sample dialogue Below is a sample dialogue. Your output can vary somewhat as long as the required data is nicely displayed <pre>What is the year, month and day of the week? <b>2023 09 05</b> September 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 </pre> You can also run a solution for this program if you want. See classroom instructions for more details. ---++Submission a. Create your SDR. * In *Lessons Learned*, include a discussion on how the methods contributed to abstraction and the readability of the code. * Your testing should include at least 2 different types of errors and ensure that every line of code is executed at least once and there is a least one month for each starting day. The actual start day does not have to be accurate (unless you are doing the extra credit) * If you used any hints, be sure to indicate that in the *Outside Resources Used* section a. Convert your SDR into a pdf document a. Create an empty zip folder a. Place your java file and pdf document in it. a. Submit the zip folder on canvas ---++Hints 1 [[CSC121F2023Lab05Hint1][Algorithm hint]] ---++ Optional improvements Optional improvements should ONLY be worked on once the program is completing working. In addition, the work is to be done on your own with little if any help for lab assistants or the instructor. 1. Compute the first day of the month. This must be a separate method
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2023-06-19
-
cathybareiss
Home
Site map
Assessment web
BethelAIResources2026 web
CenterForComputing web
ChatGPT web
Intro2AIatBethel web
Main web
Sandbox web
TWiki web
CenterForComputing Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
E
dit
A
ttach
Copyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback