Giter VIP home page Giter VIP logo

calendar's Introduction

Calendar

In this project, we'll write some code to work with dates, including days of the week and holidays.

You'll write a program that asks for a date and prints a summary for the date. The summary will include the day of the week, whether this is a work day, whether it's a holiday (and if so which), whether Daylight Savings Time is in effect, and the zodiac sign for that date. It will also print a mini calendar of the month containing that date.

Your program should work for all dates between 1980 and 2020.

Setup

  1. Each team should fork the repository.

  2. Each team member should clone the forked repository and work there.

  3. Open (not import) the project in IntelliJ.

  4. Review the code to get a general understanding of the code that's already there.

Output

Your program will look like this:

date? 2015-07-04

date:              2015-07-04
day of week:       Saturday
work day:          false
national holiday:  Independence Day
is DST:            true
Zodiac sign:       Cancer

July 2015
             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  31  

Tasks

We've provided the skeleton of the program for you, as well as some of the implementation to get you started.

Throughout the code, we use the Calendar class to represent dates. Review the documentation for this class to remind yourself of how it works and what methods are available.

In several instances, we'll be loading data out of files. We'll use files that contain the dates of major holidays, the start and end dates for Daylight Savings Time, and dates for zodiac signs. We've provided these files for you, but you'll need to write code to interpet their contents. The files are in CSV (Comma-Separated Values) format: each line contains one entry, with multiple values separated by commas.

The code has 8 methods that are missing their implementations, maked by "FIXME" in a comment. Your team's job is to replace these FIXME's with the necessary code. When you implement a method, read the method's documentation (the comment right above the method) carefully to understand what the method is supposed to do.

We've provided for you:

  • The class DateTools, which contains some useful methods for dealing with dates.

    • DateTools.formatDate formats a date as a YYYY-MM-DD string.

    • DateTools.parseDate parses a date from a YYYY-MM-DD string.

    • DateTools.getNextDay takes a Calendar and returns a new Calendar representing the following date.

  • The class FileTools, which contains a method readLinesFromFile. We'll use this for a number of the other methods, to load lines of text from a text file.

  • A file holidays.csv contains major holidays. You'll have to interpret the contents of this file and select national holidays.

  • A file dst.csv contains start and end dates for Daylight Savings Time in the United States for each year.

  • A file zodiac.csv contains start and end dates for each zodiac period.

  • The class Zodiac contains a complete implementation of the zodiac sign computation. You can use this as a reference when working on the other parts, as they share some (but not all) features.

Good luck!

Don't hesitate to shout out to @alex or the TAs on Slack if you don't understand the project, or get stuck.

Extra credit

If you would like to extend this farther, consider adding one or more of these items to your calendar:

  • season (based on solstice / equinox dates)
  • regular season and playoffs for your favorite sport
  • phase of the moon (Google it!)

calendar's People

Contributors

alexhsamuel avatar

Watchers

James Cloos avatar  avatar Alex Qin avatar Aliya Merali avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.