How can I know which days are occupied in my hotel management system? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 15 hours ago.
Improve this question
I'm a rookie and I've been tasked with creating a hotel manager for a course I'm doing. Nothing too fancy, just some application which is handled by a receptionist and is never used by the customer. It goes like this. Some customer calls the hotel and asks the receptionist: "Hey, is there any single room available from Friday 12th to Thursday 18th?" And the receptionist checks it and makes the reservations if everything is ok.
This other question (Enter an array of objects into an Arraylist of objects and change attribute) is alike, but I'd wish for that variable "Occupied" or another Boolean variable called "Reserved" to be present every day it's reserved. Thank you in advance.

Related

What is the best practice to store state variables in java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I'm new to Java.
Say I want to make a simple game with Swing or whatever. How and where do I store variables like the player's score or progress, for example, so that I can access it from different classes (during the game and before persistence in the database). I like how we use useContext in React. I also used global variables in PHP's sessions.
I highly advice to not use a "global state". I would rather recommend to implement a domain object or service that fetches high scores. This service can then be injected and called where needed.
Using a domain object or a service to access and modify domain data has the benefit that ownership is clearly defined: the business object/service owns the data, and the data is only accessed and modified through the business object/service.

Implementing Betting for a Poker Game [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am currently writing a Texas Hold'Em style Poker game that I would like both humans and computers alike to be able to play. However, I am hung up on how to implement the betting rounds. Currently I have a PokerGame class which consists of the community cards, the size of the pot, a List of PokerPlayers and a few other things. How would I implement a method that "asks" each player (I can't take input because it might just be a computer) whether they want to call, raise, etc? Originally I though I might just implement a server or possibly multithreading, but that seems way to complex. Currently my only though is setting up some sort of input stream between the game and each player in the game.
Write subclasses HumanPokerPlayer and ComputerPokerPlayer. Have PokerPlayer provide an abstract method placeBet() and override it appropriately for the human and the computer class.

How to set a restriction for each phone/user on my app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm starting to build an app where people vote certain stuff just by clicking on happy/sad faces (kind of like grading it). The thing is that I dont want to make a log-in nor registration for my app (the reason is a long story). So is there any way that I can limit people's vote to 2 per day? Every phone/user could only vote twice a day, and that count will reset after 24h from the first vote.
You have tow options:
Limit the number of votes on the device, by saving the number of votes into persistant storage on the device with a timestamp and act accordingly.
Or (more secure, but also more difficult)
Track the installations as described here identifying app installation
And send the id with every request and validate on the server side.

Creating new Class Java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Let say i got a class name resident.
When a new resident want to register, it will create a new object in the resident class and all related information is stored.
And the resident detail need to write into a file and store.
Can someone briefly tell me what to do and what method should i use? Thanks.
You'll need instance variables for the things you want to track, for example firstName, lastName, address. You can set and retrieve these values by making getters and setters for every instance variable. You could also make a constructor which assings the given arguments to the instance variables when you create a new resident, since every resident would probably need at least a firstName and other data.

Start a minute counter for every newly added item [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am developing a website where the users will add items they want to sell.
I am now trying to figure out a way how to place a munite counter for every newly added item. I need the counter to start from 0 and count every minute the item has been active. I also need the counter to reset at the end of every month and start again from 0 in the beginning of the next month.
Do you have any suggestions where I can start from?
I will appreciate any help here.
Thanks a lot!
If I were you I would store the creation date inside a database and derive the number of minutes it has been available from it. If you're going to store a counter in memory things won't scale, apart from the fact that in case of failure you would lose all information.

Categories