GithubHelp home page GithubHelp logo

calendar-in-java's Introduction

Calender in JAVA

Getting Started

CalendarGenerator is a Java program that generates a calendar for a specified year. It allows the user to enter any year and generates the corresponding calendar for that year.

Functionality

  • The generateCalendar method generates a calendar for a specified year. It first gets the current date and extracts the year, month, and day information from it. It then creates a Calendar instance set to the specified year.

  • The method loops through each month and prints the name of the month and the days of the week. It sets the calendar to the current month, gets the day of the week for the first day of the month, and loops through the days of the week until it reaches the first day of the month.

  • It then gets the last day of the month and loops through each day of the month. If the current date is today, it prints it in green. If the current date is in the past, it prints it in red. Otherwise, it prints it in the default color.

  • The program uses the Scanner class to get input from the user. It asks the user to enter a year, and the program generates the corresponding calendar for that year.

Prerequisities

You need to have the following software installed on your system:

  • Java (1.8 or later)

Installing

Clone : git clone https://github.com/OpenGenus/calendar-in-java.git

or download the repository (zip file) to your local machine.

Running

  1. Compile the CalendarGenerator.java file using the Java compiler.
javac CalendarGenerator.java
  1. Run the CalendarGenerator class using the Java Virtual Machine.
java CalendarGenerator
  1. The program will display the calendar for the current year. You can enter any year to display the calendar for that year.

  2. To exit the program, enter 'q'.

Example Output

  • Below image shows the output generated on 14-02-2023.

Output shows Calender

calendar-in-java's People

Contributors

adichat avatar

Watchers

 avatar  avatar

Forkers

sankarxace

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.