#Calendar for a Medic on java

1 messages · Page 1 of 1 (latest)

violet heath
#

Hello, everyone. First of all, I apologize for my poor English.

I recently began studying Java three months ago as part of my career. Currently, I'm working on a Hospital project using BlueJ, and I'm encountering difficulties with several tasks assigned by my teachers.

In my project, I have a superclass called Person, from which I create new Person objects with attributes such as age, name, surname, and ID. Additionally, I've created a subclass called Medic, which inherits from Person, where I include a specialty attribute for each medic.

Within the Medic class, I've implemented several methods. However, I'm struggling with a specific task: creating a calendar for each medic to determine their availability for scheduling patient appointments. Unfortunately, I'm uncertain about how to proceed with this aspect of the project.

Thank you for taking the time to read my message. Any assistance or guidance would be greatly appreciated!

uncut jasperBOT
#

<@&987246399047479336> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
Hello, everyone. First of all, I apologize for my poor English. I recently began studying Java three months ago as part of my career. Currently, I'm working on a Hospital project using BlueJ, and I'm encountering difficulties with several tasks assigned b

Management System project, and I need to create a calendar for a medic using Java.

To create a calendar for a medic in Java, you can use the java.util.Calendar and java.util.GregorianCalendar classes. These classes provide methods to manipulate dates and times, which are essential for creating a calendar.

You can create a simple calendar by creating an instance of the Calendar class and setting the day, month, and year. You can then use the get() method to retrieve information about the current date, such as the day of the week or the month.

To display the calendar to the user, you can use a graphical user interface (GUI) library like JavaFX or Swing. You can create a table with rows representing days of the week and columns representing weeks of the month. You can then populate this table with information about each day, such as appointments or events.

Overall, creating a calendar for a medic in Java involves using the java.util.Calendar and java.util.GregorianCalendar classes to manipulate dates and times. You can then display this information to the user using a GUI library like JavaFX or Swing.

tawny thorn
#

sounds like each medic needs a schedule of 7 days stating when the medic can do things

violet heath
#

Yes, thats it, including morning and afternoon times.

#

if the medic has an appointment for a specific day and time, it shouldn't allow patients to schedule appointments during that time slot

tawny thorn
#

that's another problem , one that would need a scheduler

#

which basicly does this > when an slot has been selected, it goes over all medics to see if that slot is free

#

or it retains the info of each slot and which medic has taken it, that's another approach u can take

violet heath
#

hmm

#

I have thought about creating a matrix with day and date and checking with a boolean if a certain time slot is available or not, but I dont really know if it would be easy to do or not

tawny thorn
#

all depends on what knowledge u got on java and what u can use

#

if your limited to only arrays ( as u said matrix ), then that's a good idea

violet heath
#

I don't have many more options because it's quite limited, but the main problem I have is that I have another class called 'gestion' where I store all the appointments, and I don't know how to access the ArrayList that stores them in order to check with a boolean from the 'medic' class if a certain time slot is available.

#

one of the requirement of the exercise is that all fields must be private

tawny thorn
#

u know the terms getter and setter ?

violet heath
#

yup

#

how could I use it on arraylist?

tawny thorn
#

so u use a getter :p

#

u use it the same way u would on any primitive, only u return a List<Foo>

violet heath
#

oh okay

#

i'll try it then

tawny thorn
#

pref unmodifuable but u wouldnt have seen that yet

violet heath
#

I think I actually didnt xd

tawny thorn
#

but before u code any further, i would try to write your idea out on paper

#

if im following your flow, your going to block yourself soon

violet heath
#

okay, i'll try to write it cuz im kinda blocked rn lmao

#

thanks mate

tawny thorn
#

one of your profs should mention that soon, as people tend to start coding directly instead of quickly drawing some design down on how to handle the problem

#

like, why a boolean to check if a slot is availble

violet heath
#

I actually try to draw some designs but because of my low knowledge my designs use to be really poor

#

idk, I've just seen many projects with booleans to check if things are available

tawny thorn
#

yeah, but look at it from the other angle

violet heath
#

which angle

tawny thorn
#

u start with a collection of slots yes ?

#

normally at start they are all free

#

when u run the algo to update the slots, they become not-free

#

so there is no need to check if its free on the medic side

violet heath
#

thats a good point

#

i'll try to look at it from other angle then

#

thanks a lot!! 🙂

tawny thorn
#

try to read your assigment slowly and try to understand it

#

the wording your using would imply that each medic class has its own schedule

violet heath
#

The only tricky part is that it's 14 pages long

violet heath
tawny thorn
#

the longer the better !

#

the longer it is, the more limits u hit and the easier it is to make it

violet heath
#

wait, not medic class, medic object

tawny thorn
#

no the phrase u used on the question would imply that each medic class has a schedule

#

not Person

#

and the object Medic comes from the class 😉

violet heath
#

kk im going to draw some thing and I'll see if I can do it with your advices

#

programming is harder than I thought xd

#

and sometimes kinda frustrating

tawny thorn
#

there's people here day and night so someone should help when u get stuck again

#

the actual programming is easy. Problem is figuring out how to do it

violet heath
#

thats cool, but I would prefer doing it by myself to learn more

tawny thorn
#

that's the best and only way

violet heath
#

cause its actually cool having some help but u dont learn as much as if you do it by yourself

tawny thorn
#

u wont be handed the solution

#

have a look at the rules here, u will notice that they are very, very good towards helping ( getting to understand how and why to do it, instead of c&p )

violet heath
#

what is c&p?

tawny thorn
#

copy paste

violet heath
#

well

#

to copy and paste u have chatgpt

#

xd

tawny thorn
#

which is about as good as a donkey writing code blindfolded :p

violet heath
#

lmao

tawny thorn
#

gpt is a search bot, it cannot reply on things it hasnt seen before

violet heath
#

yup

#

chatgpt gets wrong many times

#

I asked him things as how enum works and it got wrong

#

so I don't really trust chatgpt at the moment

tawny thorn
#

gpt has 2 states

#

the state it is in where every loves it, and then the state where we try to stop it, as it becomes to smart and we are obsolete

#

gpt is even a worse then a smartphone, people came to rely on it soo fast

violet heath
#

it happened a lot to me

#

I used to ask him everything

#

and i really apologize

#

do you have any tips on how to draw good diagrams?

#

because the one I draw are bad af

tawny thorn
#

what software do u use to make em ?

violet heath
#

wait

#

do I have to make em on a software? xd

tawny thorn
#

no but it helps 😉

violet heath
#

I make them at scrble INT

#

its like paint

tawny thorn
#

have a look on StarUml or plantUml

violet heath
#

okay

#

lemme see

tawny thorn
#

there's probably alot more specialized ones, but those are free and not hard to figure out

violet heath
#

which one would be easier to understeand for a really novice ?

tawny thorn
#

plantuml

violet heath
#

okay

tawny thorn
#

basicly text based

violet heath
#

StarUml looks more visual

tawny thorn
#

this is an example

#

source text on the left, generated diagram on the right

violet heath
#

it looks great

#

ill download it then

#

thanks dude