All Questions
22 questions
2
votes
0
answers
71
views
Classes for Config and logical operators
I have a spring cloud gateway application with this yml structure for request validation:
...
1
vote
1
answer
482
views
Model animals using inheritance in Java
I was assigned the following problem:
You've gone back in time to 500BC Athens and Socrates wants you
to build him an app to help classify animals.
Build the classes ...
4
votes
2
answers
138
views
Human Jug and Glass
I am a beginner in Java. I have created this small project in Java with the inheritance concept. Here the Human will fill, pour and drink water. There are three classes: Glass, Jug and Human. Let me ...
5
votes
1
answer
132
views
Classes to encode and decode images
I'm a developing a image processor, which reads a Base64 (compressed) image and writes its subimage to targets on threads.
(Constructors, exception handling, and ...
6
votes
4
answers
3k
views
Better way to add fields to superclass in Java
I'm making my first steps in OOP and I'm currently doing some exercises. I've done a simple program with class structure like this (I'll provide only essential parts):
Super class:
...
5
votes
1
answer
4k
views
Custom ResponseModel for Spring Controller - ResponseEntity<?>
I created a custom responseModel to have a standard json responseModel for some of my different RestController.
Superclass TransactionResponseModel:
...
3
votes
3
answers
5k
views
OOP modelling of a car agency
Exercise:
A car dealer wants a computer system to manage the data of their vehicles and classify them by type.
All cars have the following data
Engine serial number
Brand
Year
...
9
votes
1
answer
3k
views
OOP modeling of a boat rental system
I have some question about this exercise, did I model the problem correctly (the code works)?. If I did it correctly, Is there anything that can improve the code?. For example, how could I avoid the ...
4
votes
3
answers
118
views
Viewing the final state of an Object
As a beginner I was writing a code which asks the burger buyer what they want in their burger. I did this by creating a burger object and modify its attributes by the user using a switch case method. ...
0
votes
2
answers
242
views
Very complicated Java HelloWorld app
This program attempts to shows the basic concepts of inheritance and polymorphism. In what ways could the code be modified to better demonstrate those concepts? The interface, abstract class and the ...
0
votes
4
answers
237
views
Multilingual command handler using inheritance
My problem is that you have a lot of ifconditions to be checked and inside that if condition you have multiple lines of code. I ...
7
votes
2
answers
603
views
Java - Something similar to Abstract Factory?
I have many repositories stored in a map. User chooses some of them and then a downloading begins. Repository may be one of 4 types (see code below).
...
2
votes
1
answer
1k
views
Lockable linked list
The existing design of class DList and DListNode is taken. The main criteria is to do successive updates in \$O(1)\$ time.
Part ...
6
votes
1
answer
380
views
Code Golf challenge that plays Mafia
I am working on writing a Code Golf King of the Hill challenge, the details of which can be read here. You can read the full code here.
Briefly, the game proceeds in cycles of night then day. There ...
11
votes
2
answers
5k
views
Decomposing the animal kingdom
I have implemented a Mammal class hierarchy in Java.
Is it an intelligent approach, with respect to decomposition, locality and procedural abstraction?
...