id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david_petty@psbma.org > thanksgiving
prev  |  next  |  chance

/*
 * Thanksgiving.java
 *
 * Write a method int thanksgiving(int year) that takes a year > 1999 and
 * returns the day of the month of November on which USA Thanksgiving falls.
 *
 * @author YOUR NAME HERE
 */

public class Thanksgiving
{
    // Precondition: year > 1999
    public int thanksgiving(int year)
    {
        final int YEAR = 2000;  // first valid year for this method
        final int NOV1 = 3;     // 2000/11/01 falls on a Wednesday
        final int THURSDAY = 4; // (Sun = 0, Mon = 1, ..., Sat = 6)
        return 0; // STUB
    }
}

thanksgiving(2000) → 23
thanksgiving(2001) → 22
thanksgiving(2002) → 28

...Save, Compile, Run (ctrl-enter)

public int thanksgiving(int year) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 100

Copyright Nick Parlante 2017 - privacy