473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Creating an Appointment Book...=[

I'm not asking for source code, but simply help on this concept.

I am required to make an Appointment Book. My program looks like this :

http://i49.tinypic.com/9amio5.jpg

I need to be able to display appointments that occur only today.

I have an array which holds all the appointments. And i have an abstract class Appointment with an abstract method called occurs_on. It has three child classes which are the radio buttons you see in the picture. OneTime Daily and Weekly

They child classes return true if the appointment occurs on today's date. I am having trouble understanding how to print appointments which only return true.

This is pretty much what I need to do... I know it is long, I'm sorry! I hope someone will be able to help me out =x I am struggling so much:
--------------------------------------------------------------------
Operation
• When the user selects the Add Appointment button, an appointment is created based on the day, month, year, hour and minute the user input. The user can Add a One-time, Weekly or Daily appointment to the Appointment Book.
• When the user selects the Display Appointment, all appointments that occur on the day input by the user (through the Day, Month and Year) will be displayed.
• When the user closes the frame or presses the Exit button, the application exits.

Specifications
• Create a Frame class
• Use a try/catch and exceptions to check for valid numbers, i.e. month should be between 1 and 12. Use a JOptionPane.showMessageDialog to let the user know there was an invalid entry.
• Create a Panel class, with buttons, labels, text fields, etc. When the user selects the Add Appointment button, a Weekly, Daily or One-Time object is created and then added to the ArrayList. The fields are then cleared. Only the day, month and year is needed for the Display Appointments action.
• Create an abstract Appointment class, with a String to hold the appointment description and a GregorianCalendar object to hold the date and time of the appointment. There will be an abstract method occurs_on(int day, int month, int year) which returns a Boolean. Add additional methods as needed.
• Create three classes that inherit from the Appointment class: One_time, Weekly, Daily. Each class overrides the occurs_on() method. The occurs_on() method determines if the appointment occurs on the particular date passed in.
• Create an Appointments class that has an Arraylist of Appointment objects. You will need a method for adding an Appointment and for displaying Appointments. The method for displaying Appointments will call the occurs_on() method for each of the Appointment objects in the ArrayList. If the occurs_on() returns true, the Appointment will be displayed. The appointments may be displayed with a JOptionPane.showMessageDialog
-------------------------------------------------------
Attached Images
File Type: jpg Appointment.jpg (11.7 KB, 542 views)
Feb 8 '10 #1
3 5454
chaarmann
785 Expert 512MB
Go through all appointments of your array with a for-loop and look at the actual appointment object. This object should have a method that gives you the date (day, month, year) and the appointment type.
Then if this date is exactly the same as the current date, (see GregorianCalendar class), display this appointment (if type=one-time), else go on to the next one of your loop.

Of course, you have 3 differnt types of appointments. So if it is daily, list it always right away.
If it's a one-time appointment, list it if it matches the current date. (see above)
If it's a weekly one, you need to figure out the day of the week (monday, tuesday, ...sunday) for the current appointment and the day of the week from today. If both match, then print the current appointment. Again, the GregorianCalendar Class provides a method where you simply pass the date to get the correponding day of the week back.
Feb 8 '10 #2
Thank you for your reply!

Unfortunately I already understand that concept, the problem is, I need to create an abstract Appointment class which has an abstract occurs_on method.
The occurs_method is passed in the year day and month of each appointment added (it is overridden in the child classes). Depending on the type of Appointment, the occurs_on method is called in either the daily, one time, or weekly. My problem of understanding is when one of the child classes are called and it returns true or false, where is it returned to?

i don't understand how to get only the ones that return true to print.

*** i also did something wrong. i should be using an arrayList not array =x
Feb 8 '10 #3
chaarmann
785 Expert 512MB
When you create objects with the "new" operator, you give its class name. In your program, depending on the type, you would create objects of 3 different classes and store them all in your array.

Later when you fetch an object from your array, you call:
boolean success=object.occursOn(today);
This sets success to true or false. The object knows which class it is, it remember which class name you gave when you created it, so it will only execute its own occursOn() method and not the one of another class. And only the value returned from this method will be passed back into boolean variable success!
Feb 9 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Matt Moran | last post by:
I need/want to be able to send an email from a website running IIS and CDONTS for mail (or ASPMAIL) that comes into the inbox as an appointment to be accepted. The company is not running...
5
by: gil | last post by:
I initially tried building a coded system where numbers 1 through 10 referenced a certain type of recurring appointment, and would then call a specific function for each, but as more appointments...
3
by: Sam | last post by:
My db looks after the hiring and lending of equipment, the form which books out equipment hired prints a signout sheet and automatically inserts an appointment into outlook advising the operator on...
0
by: saurabhaggarwal | last post by:
Hi Suppose there is backend that stores all the appointments that are currently there in outlook. The job of my plugin is to add all the appointments that are there in outlook back to the...
1
by: jodyblau | last post by:
I am using the code provided by MSDN to set an appointment on my Outlook. However, I would like to adjust this code so that instead of setting the appointment on in Outlook on my computer, it...
0
by: Chicka | last post by:
I need/want to be able to send an email from a website running IIS and CDONTS for mail (or ASPMAIL) that comes into the inbox as an appointment to be accepted. The company is not running...
13
by: YoVoltron | last post by:
I am just starting this "appointment book" java program and would appreciate some basis direction. I do not expect anyone to write the code for me but i would like opinions on how to best handle the...
4
by: reyalberto | last post by:
I am interested in creating an online appointment page where my clients can login and set an appointment with me. I'm somewhat familiar with PHP, but would like to know how should I go for creating...
1
by: johntech | last post by:
I would like to create an appointment book in visual basic as a stand-alone program that you don't need any Office programs loaded. I don't need any code just some ideas on file setup for saving the...
0
by: Ben Grimwade | last post by:
Hi, im developing an Application that integrates with Outlook by creating an appointment in there calender. The code in question is below Dim appt As Outlook.AppointmentItem obj =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.