Introduction
Welcome to the first of your assignments for COMP90041 – Programming and Software Development!
For this project, we will be implementing the calendar app but on a console (terminal).
This program will be built in two parts (Assignment 1 and Assignment 2), with Assignment 1 building the groundwork for the final system in Assignment 2.
In Assignment 1, we will build an initial system implementation based on what we’ve learned about object-oriented programming so far. In Assignment 2, we will extend the system with additional features, and also refactor existing features with newly learned Object Oriented Programming concepts, to make our code more elegant.
This project intends to give you practice with basic Java concepts and basics of object-oriented software development and design, as well as some experience in developing software as requirements for a system’s evolution. It also provides some good experience in building a system part by part from scratch, until an overall system is complete.
Preamble: “The Specifications”
The slides from this lesson module for the assignment act as “the specifications” for the system we are about to build.
“The specifications” in real-life software development is the document that details the features that should be implemented in any particular project. They are the features and requirements that you, the Software Developer, and the client have agreed should be implemented in the system.
As such, you should read these specifications carefully and ensure that your program implements the requirements of the specification correctly.
Tests will be run on your program to check that you have implemented these specifications correctly. When you hit the mark button, your code is submitted and tests are run on your code after compiling it. This is an automatic process and you can make as many submissions as you want before the deadline. If you make submissions after the deadline, they are marked Late and not assessed until you have a valid extension. If you have a valid extension and see your submission is marked Late, do not worry about it. We will mark the assessment as per your extension.
Note that for this project, we will provide 13 visible tests that you can run to check that the basic functionality of your system is correct. However, there will also be 7 hidden (i.e., invisible) tests that we will run when assessing the correctness of your code. You won’t be able to see why your hidden tests failed but you can see that they failed and rectify your code. So once your program passes the basic tests, we strongly recommend that you perform further tests yourself, to ensure that the required features have been implemented correctly.
How to read the specifications?
Some parts of the specification may need you to use specific methods from Java in-built System or Util libraries. Or there can be certain assumptions that are okay to make by the students. We will provide additional help/suggestions using a green callout like the example provided below.
Tip: use a specific string method like toLowerCase or something.
Some specifications are treated as warnings. If not implemented correctly, they can cause incorrect output. They are shown in yellow warning callouts like the example provided below.
Warning: Read this section carefully. Some additional texts to tell you what can go wrong.
Some texts could be just informational. They neither cause you problems nor help you but guide you gently on what to do next. They will be shown in blue callouts like the example provided below.
Note: Perhaps re-read this section first and then go to other section.
Lastly, sometimes a developer thinks exhaustively and engages in continuous discussion with people to gather more information. We try to keep certain use cases out of scope as they add more complexity to the system. Some advanced developers can cope through it but we would like to keep some things simpler for beginners. Please read carefully through the out-of-scope specifications as well. This may be embedded as a red strip in the specifications sometimes.
Out of Scope Scenario: This scenario …….. is out of scope for this assignment
Other than this, we will use the general informational, warning, error, and assumption callouts using blue, yellow, red, and green coloured callouts.
Also, note that the code snippets have some characters in bold that represent the inputs to the program.
Assumption: Students can assume that test cases only contain outputs that are explicitly part of specifications. The test cases, visible or hidden, do not produce any output that is not mentioned in the specifications explicitly. Please note that the specifications will give you warnings and important notes where we expect special input handling. You should observe those and implement them accordingly as they will be tested while marking your program.
Preamble: Intended Learning Outcome
The Intended Learning Outcomes for this Assignment are mentioned below –
The concepts used are from Week 1 to Week 6.
ArrayLists are not allowed for this assignment. The intention is to test the above ILOs and hence use of ArrayLists are prohibited.
A warning for those that have previous experience programming in other programming languages (like C or Python) that follow a procedural programming paradigm: Be careful to develop your program using object oriented principles, as programming and structuring your code in a way that is not object-oriented is an easy way to lose marks for structure in the assignments.
Preamble: Java Coding Conventions
We will also be assessing your code for good structure and style.
Use methods when appropriate to simplify your code, and avoid duplicate code.
Use correct Java naming conventions for class names, variable names, and method names and put them in a well-organised way in your code i.e. it should be readable as well.
Make sure the names you choose are meaningful, to improve the readability of your code.
We will provide a marking scheme to help guide you in the development of your program. Also we will guide you how to model your program. But using correct syntaxes and conventions can be learnt here.
Calendar Console
Welcome to CalendarConsole (aka CalCon).
We will not develop a UI-based calendar here as it needs an advanced level of programming. We will develop some features from a calendar app but with a console-based input.
Warning: The program expects some command line parameters that we will discuss in CalendarInitialisation section. These command line parameters are set in EdStem platform and will be available to the program when you hit the submit/mark button. But if you are trying this in an IDE, you may have to set the command line parameters yourself using command line or IDE Run/Debug features. More details in Additional Help section.
Calendar Initialisation
Calendar
The calendar is a 6×7 matrix (6rows 7 columns) that can be represented by a 2D array. The calendar starts from Monday. Below is a representation of calendar in a console. The numbers represents day of the month.
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| x | | | | | | |
| | | | 2 | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Each row represents three things –
Command Line Arguments
Read some command line args to set the year, month, day from which the calendar starts. The program must take command line inputs in the below order.
This means when you compile your program and run it, the commands on the terminal should look like this
javac CalCon.java
java CalCon 2025 04 12
Warning: You must not hard code this in your program. We may provide all kind of integer outputs to test these.
In case there are insufficient inputs (missing input) or if any of the input is 0 or negative, then exit the program by printing the error message –
javac CalCon.java
java CalCon 2025 04 -12
Invalid Year/Month/Day. Exiting Program.
Note: These command line parameters are set in EdStem platform and will be available to your program when you hit the submit/mark button. But if you are trying this in an IDE, you may have to set the command line parameters yourself using command line or IDE features.
If the inputs are valid, the program will show a calendar view.
Out of Scope: You can assume that the command line arguments are always integers and not String/Double or any other data types.
How to initialise/create the calendar?
This will create an empty calendar with each calendar entry set with the date with no events.
Date.java is provided to you. You can add methods to it if you need. But you must not change existing methods presented to you. Or simply use the methods available in this class to work. You do not need any external java libraries to manage the date.
Main Menu
Main Menu
Once the calendar is initialised the program will show the Calendar initialised with dates and the cursor ‘x’ on the first date. The next thing to show is the main menu for the user to select and perform some operations.
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| x | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
The program should then take a user input and perform one of the actions out of the 7 given.
Exit Option
In case the user selects option 7, the program must gracefully quit the program and print a goodbye message.
Warning: Do not use System.exit() as it is not a graceful exit.
Look at the complete output below.
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| x | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 7
Exiting CalCon Now.
Note: The text in bold represents user input here. You don’t need to make the console inputs bold in your code.
Invalid Command
In case the user provides an invalid input like 8 or 9, the program should be able to print “Invalid Input” and show the main menu. Sample output
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| x | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 8
Invalid input.
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| x | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
Out of Scope: The program only expects an integer value for the main menu. You do not need to handle string or double values as input at this point of time for the main menu.
Move Cursor
To add/edit/delete the event(s) in the calendar, user must select a date first. To select a date, the user should be able to navigate the calendar dates. There are 4 options present in the main menu for the user to navigate.
We will now look at these options closely.
Option 1:
When the user presses 1, the cursor moves to the one right i.e. to the next date. See the output below –
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| x | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 1
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | x | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
Special Cases –
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | x |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 1
Invalid location on calendar.
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | x |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
Option 2:
When the user selects option 2, the cursor should move to the one left. See the output below –
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | x |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 2
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | x | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
Special Cases-
Option 3 & 4:
If the user selects option 3 move the cursor’s position to the first date of the calendar. Similarly, if the user selects option 4, move the cursor to the last date of the calendar shown. See output below –
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | x | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 3
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| x | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 4
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | x |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
Note that if the cursor is already at the designated place, and the user selects option 3 or 4, the program will simply reprint the calendar and the main menu again.
Events
Option 5: Move to current selected date’s submenu options
When the user selects option 5 this means that the user wants to add/modify/delete events for that particular date. The program should print a sub menu when the user selects option 5.
————————————
| M | T | W | T | F | S | S |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | x | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 5
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
Once the submenu is printed, the user can take multiple actions.
Option A: Adding an event
To add an event the program must take certain data inputs from the user. Once taken, it should add the event to that date. Note that there could be more than one event added to a date. Once an event is added and the user returns to the main menu, the calendar should also show the updated count for the number of events present on a date. See the output below –
————————————
| M | T | W | T | F | S | S |
————————————
| 26 | 27 | 28 | 29 | 01 | 02 | 03 |
| | x | | | | | |
| | | | | | | |
————————————
| 04 | 05 | 06 | 07 | 08 | 09 | 10 |
| | | | | | | |
| | | | | | | |
————————————
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| | | | | | | |
| | | | | | | |
————————————
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| | | | | | | |
| | | | | | | |
————————————
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
| | | | | | | |
| | | | | | | |
————————————
| 01 | 02 | 03 | 04 | 05 | 06 | 07 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 5
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
> A
To add an event, enter the following details
Event Type (REMINDER, BIRTHDAY, ANNIVERSARY, MEETING) : MEETING
Start Time (HHmm) : 0900
End Time (HHmm) : 1000
Description : Test test
Event added successfully.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
> Q
————————————
| M | T | W | T | F | S | S |
————————————
| 26 | 27 | 28 | 29 | 01 | 02 | 03 |
| | x | | | | | |
| | 1 | | | | | |
————————————
| 04 | 05 | 06 | 07 | 08 | 09 | 10 |
| | | | | | | |
| | | | | | | |
————————————
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| | | | | | | |
| | | | | | | |
————————————
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| | | | | | | |
| | | | | | | |
————————————
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
| | | | | | | |
| | | | | | | |
————————————
| 01 | 02 | 03 | 04 | 05 | 06 | 07 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
Option E: Editing an event
To edit an event, the user should select the event number to edit from. Thus we will show all the events on the selected date and let the user choose from the event to edit. Once the event number is selected, the program should prompt the user to input details similar to the add event scenario. See the output below –
————————————
| M | T | W | T | F | S | S |
————————————
| 26 | 27 | 28 | 29 | 01 | 02 | 03 |
| | x | | | | | |
| | 2 | | | | | |
————————————
| 04 | 05 | 06 | 07 | 08 | 09 | 10 |
| | | | | | | |
| | | | | | | |
————————————
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| | | | | | | |
| | | | | | | |
————————————
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| | | | | | | |
| | | | | | | |
————————————
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
| | | | | | | |
| | | | | | | |
————————————
| 01 | 02 | 03 | 04 | 05 | 06 | 07 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 5
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
> E
To edit an event, select an event number from below –
Following event(s) found for the day –
> 2
To edit this event, enter the following details
Event Type (REMINDER, BIRTHDAY, ANNIVERSARY, MEETING) : BIRTHDAY
Start Time (HHmm) : 0900
End Time (HHmm) : 1000
Description : Trina’s Bday
Event updated successfully.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
>
Option D: Deleting an event
Deleting an event is similar to editing an event. The user must choose the event number from the list of events present on the day to delete. See the output below –
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
> D
To delete an event, select an event number from below –
Following event(s) found for the day –
> 2
Event deleted successfully.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
>
If the user selects option V after this, the deleted event should not be present in the list.
Option V: Viewing an event
Viewing a day’s event will simply list all the events present on the selected day.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
> V
Following event(s) found for the day –
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
>
Use the formatter “%d. %s Event %s: %s – %s%n” to print a single event for the day in a loop.
Option Q: Quitting the submenu
If the user selects Q, the program must quit the submenu, print the calendar view and go back to the main menu.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
> Q
————————————
| M | T | W | T | F | S | S |
————————————
| 24 | 25 | 26 | 27 | 28 | 01 | 02 |
| x | | | | | | |
| 2 | | | | | | |
————————————
| 03 | 04 | 05 | 06 | 07 | 08 | 09 |
| | | | | | | |
| | | | | | | |
————————————
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| | | | | | | |
| | | | | | | |
————————————
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| | | | | | | |
| | | | | | | |
————————————
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| | | | | | | |
| | | | | | | |
————————————
| 31 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
Special Case
In case of editing/deleting/viewing if there are no events present for the day, show the error message and print the submenu.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
> V
There are no events marked in the calendar for the day.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
>
Invalid Option
Note that the submenu receives an input string for A/E/D/V/Q. Thus any input which is a string but is not an valid option should be handled accordingly with an error message printed.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
> K
Invalid input.
Press V to view all events.
Press A to add an event.
Press E to edit an event.
Press D to delete an event.
Press Q to exit.
>
Tip: String comparison for A/D/E/V/Q ? Consider case insensitivity while comparison.
Option 6: Viewing all the events in the calendar
If the user wants to see all the events marked in the calendar, the program must present it in a tabular form.
————————————
| M | T | W | T | F | S | S |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | x | | | | |
| 2 | | 1 | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 6
————————————————————————————————————
ID Date Start Time End Time Event Type Description
————————————————————————————————————
1 2025-04-07 0900 1130 MEETING STUDENT REP
2 2025-04-07 0000 2359 BIRTHDAY Jane Doe’s Bday
3 2025-04-09 0000 2359 BIRTHDAY Trina Dey’s Bday
————————————————————————————————————
————————————
| M | T | W | T | F | S | S |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | x | | | | |
| 2 | | 1 | | | | |
————————————
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| | | | | | | |
| | | | | | | |
————————————
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| | | | | | | |
| | | | | | | |
————————————
| 28 | 29 | 30 | 01 | 02 | 03 | 04 |
| | | | | | | |
| | | | | | | |
————————————
| 05 | 06 | 07 | 08 | 09 | 10 | 11 |
| | | | | | | |
| | | | | | | |
————————————
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
However, if the calendar has no events, the program should show an error message.
————————————
| M | T | W | T | F | S | S |
————————————
| 02 | 03 | 04 | 05 | 06 | 07 | 08 |
| | x | | | | | |
| | | | | | | |
————————————
| 09 | 10 | 11 | 12 | 13 | 14 | 15 |
| | | | | | | |
| | | | | | | |
————————————
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| | | | | | | |
| | | | | | | |
————————————
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| | | | | | | |
| | | | | | | |
————————————
| 30 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
> 6
No events present in the calendar.
————————————
| M | T | W | T | F | S | S |
————————————
| 02 | 03 | 04 | 05 | 06 | 07 | 08 |
| | x | | | | | |
| | | | | | | |
————————————
| 09 | 10 | 11 | 12 | 13 | 14 | 15 |
| | | | | | | |
| | | | | | | |
————————————
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| | | | | | | |
| | | | | | | |
————————————
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| | | | | | | |
| | | | | | | |
————————————
| 30 | 01 | 02 | 03 | 04 | 05 | 06 |
| | | | | | | |
| | | | | | | |
————————————
| 07 | 08 | 09 | 10 | 11 | 12 | 13 |
| | | | | | | |
| | | | | | | |
————————————
Select an option to proceed.
Press 1 to move to next date.
Press 2 to move to previous date.
Press 3 to jump to start.
Press 4 to jump to end.
Press 5 to enter current selection’s sub menu.
Press 6 to view all events in a calendar.
Press 7 to exit.
>
Tip: Use the pattern %2s%12s%12s%12s%12s%40s%n for the formatted output.
Out of Scope: When your program terminates you don’t have to save the calendar events or any other data. The program resets to default.
Reviews
There are no reviews yet.