All Questions
Tagged with javaobject-oriented
727 questions
82votes
6answers
233kviews
Design a chess game using object-oriented principles
I would like to know if my approach is correct and how could it could be improved? Also, is there a way to get rid of the relation between the Piece and the ...
43votes
5answers
41kviews
Designing a coffee machine
I was recently rejected from what looked like a really promising string of interviews. I did very well in a questionnaire style review, and then they handed me this assignment (more or less): Design ...
30votes
7answers
29kviews
Basic OOP Poker - Deck, Cards and Hands
I decided it would be interesting to simulate a game of Poker. Baby steps at the moment, and eventually I'll attempt to turn it into a GUI. The code I have so far is very basic such as populating a ...
26votes
4answers
4kviews
Calculate distance using speed of sound
I've been working on learning Java and this was a challenge as part of a chapter on data types: Create a program that computes how far away, in feet, a listener is from a sound. Sound travels ...
26votes
5answers
33kviews
Object Oriented Design of Card Deck
I am designing classes for a game with card deck. Please review my code. Each Player gets Hand of cards The Deck can be shuffled and cards are dealt one at a time from the deck and added to the ...
25votes
3answers
4kviews
What does the Bob say?
Description: Bob is a lackadaisical teenager. In conversation, his responses are very limited. Bob answers 'Sure.' if you ask him a question. He answers 'Whoa, chill out!' if you yell at ...
23votes
5answers
7kviews
Modelling a Call Center
This is the requirement I have (from the book: Cracking the Coding Interview) Imagine you have a call center with three levels of employees: fresher, technical lead (TL), and product manager (PM). ...
23votes
4answers
28kviews
Simple builder pattern implementation for building immutable objects
This is a builder pattern implementation to build immutable Person objects: Person class ...
21votes
3answers
2kviews
How to Train Your Dragon
I started out practicing on implementing the builder pattern and somehow ended it up with this 2 hours later. It isn't really much, but it works and I'm hoping review should bring about a lot of ...
20votes
2answers
5kviews
Designing another Coffee Machine Application
After reading Designing a coffee machine yesterday, I decided I could also give the same problem a try. I have used the following problem statement (copied from the given question): Design a coffee ...
17votes
5answers
2kviews
Generating Robot Name
Problem: Write a program that manages robot factory settings. When robots come off the factory floor, they have no name. The first time you boot them up, a random name is generated, such ...
16votes
4answers
16kviews
Simple Blackjack game in console
edit: After receiving the great feedback, I have tried to make my code better. The new version can be seen here: Simple Blackjack game in console (update) This is one of my first finished projects ...
15votes
7answers
7kviews
Java OOP Temperature Converter
I am doing a college exercise and would like to know how to improve the execution of the idea. The idea is to create a program that converts temperature measurements. Main.java ...
15votes
5answers
19kviews
Tic Tac Toe game in Java OOP
I have written a simple GUI Tic Tac Toe Application and since this is my first shot, I think it can be improved a lot. Please tell me what you think about it and what you see I made wrong so I can ...
15votes
3answers
42kviews
Text-based RPG in Java
I'm writing a simple text-based RPG in Java. I think it's a good exercise to practice OO and think about how objects should best interact. I'd be interested in hearing any thoughts! The ...