Tagged Questions
-1
votes
0answers
24 views
my failed solution for sales tax calculator [closed]
Recently I have been on the last stage of an interview process where I was asked to provide a solution to this tax calculator problem
...
2
votes
1answer
32 views
Applying DocumentListener on multiple JTextField
Say I have 5 JTextField: jTextField1, jTextField2...
Now I want them to behave the same on DocumentListener, so I decided to make only one DocumentListener and set it to the 5 components.
Meanwhile ...
6
votes
3answers
313 views
Which of these two java class designs is better and why?
Example 1:
public interface Adder {
public int getSum();
}
public class AdderImpl implements Adder {
private int v1;
private int v2;
public AdderImpl(final int v1, final int v2) {
...
1
vote
0answers
34 views
How do I structure my entities for easier persistence?
I am learning ORM using Hibernate by creating a movie rental application. Currently, I have the following three entities for persistence:
User
Movie
Rental (composite element for many-to-many ...
0
votes
3answers
46 views
Implementation of an UniqueIdentifier class
I have a requirement to implement a generic UniqueIdentifier which can cover identifiers like OrderId, TrackingID, scannableId and other Ids. The ids, as they are now, are either Long or String.
Below ...
1
vote
0answers
22 views
Is this a good approach for a BayeuxClient class?
Is this a good approach for a BayeuxClient class?
Reading cometd reference book, Chapter 6 Java Libraries, I created this BayeuxClient class.
As a newbie to cometd, I would like to know if this ...
4
votes
4answers
204 views
Command line Contact Management
Can you please review the following code and give any suggestions for improvment?
Class ContactList.java
import java.io.*;
import java.util.*;
public class ContactList {
public static void ...
-1
votes
1answer
98 views
design classes for a JAVA swing application [closed]
I am very new in making JAVA swing applications..
My problem statement is to make a library management application,for which i designed classes as below.
Please tell me whether my design of classes ...
1
vote
2answers
98 views
Shortening System.out - which is better? [closed]
Oftentimes people will shorten System.out to just out and make an analog called in (e.g. Scanner in = new Scanner(System.in);). I've seen two methods of doing this
Method 1:
import static ...
0
votes
1answer
125 views
Review algorithm of this code
In this piece of code i have to display some set of
data in serpentine order.In an experiment there are Replication,range,plot
Replications contain range,plot.A range contains plot.
if there is 2 ...
0
votes
2answers
88 views
A sample java class for review
Let's say the method foo() has lot of code and it also includes doing something for bar1, bar2 and bar3, maybe setting some status or print something or something else which is being done in just one ...
2
votes
1answer
86 views
Java Swing Panel layout
I am working on a Java project for college that involves us setting up a TCP Server and Client. I have that part working and now to add more of a feel to my project I want to add a GUI.
We have not ...
5
votes
1answer
104 views
Please review following code
Please review the following code. Methods getFirsts and getSeconds return a list of objects which implement CommonInterface and both of them are private. Is it a good or bad design.
@Override
public ...
6
votes
1answer
225 views
Criticism on OO design (Java)
The domain model of my application revolves around movies.
The use case is following: we have a movie for which only one title (in one country) is known and we want to know titles of this movie in ...
0
votes
1answer
79 views
java code design puzzle for common function result module
I am trying to solve a puzzle. I came up with a few classes to represent results. They looked similar, so I defined a common Result class. But what if I need to define different results according to ...