Speed dating class java


For example, consider this:. The pairing male1 — female1 is expected, as both like each other.

Report Abuse

However, male2 — female2 is dubious. Due to your implementation, the reverse is not true:.

Static methods

Completing method bodies in the SpeedDating class. Such single-method classes encpasulating an algorithm should only be .. problems (for example, a problem of Ménage à trois speed dating).

Better rankings that use the female rankings to break ties could be a modified Manhattan Distance:. Computationally speaking, I don't have anything to add what has already been said. I would say that, genderly speaking, it could be made more generic:.

Speed Dating: Teaching Strategy for the Classroom

To conclude, one solution would be to make two lists of Individual s. Not only would it be more respectful towards many many people in the world, but you could also get rid of your Male and Female classes: Everywhere you have variable names containing male or female , you can replace them by person1 and person2 or individual1 and individual2. Never forget that you should treat people as people, and consider how they define themselves before considering how you would like them to be. Looks good, I didn't work through the logic of your algorithms, but generally looked if things could be done more efficiently and nothing grabbed my attention.

Speed dating class java

The one comment I do have is on your validate method, it checks for null and empty maps, but I believe you have an additional requirement that they are the same size? If so, this should be part of the validate method as well. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service , privacy policy and cookie policy , and that your continued use of the website is subject to these policies. Home Questions Tags Users Unanswered. Speed dating algorithm to select the pair of dates Ask Question. JavaDeveloper JavaDeveloper 4, 23 79 There are very few parts which could be criticized: We can do all of that in one loop: Test that the number of returned pairs is correct Test that the collection of pairs contains an expected pair.

This implies that you should override equals and hashCode for the Pair class.

More than the age of the universe

This index shuffling servers no purpose, and can be removed by using zero-based preferences I did a bit of refactoring incl. For example, consider this: Due to your implementation, the reverse is not true: Better rankings that use the female rankings to break ties could be a modified Manhattan Distance: I would say that, genderly speaking, it could be made more generic: You would have to take into account homosexual and bisexual people too.

That would mean that your Person instances should also have a variable specifying what is the sexual orientation of the instance. You could use a percentage to roughly represent whether the subjects are more interested in males or in females; that percentage could be taken into account in the rating algorithm. That may be very offensive since many of them have a hard time finding a place in society and try to conform to one gender while there is no "dedicated" gender for intersexual people.

Some Java Programming Homework

That could feel like an insult. Also, some try to assume an intersexual identity instead of trying to conform to "male" and "female".

  1. results of online dating.
  2. dating sites 3 networks.
  3. intj female dating.
  4. founder of dating daan.
  5. gay marines dating.

Therefore, you could consider their gender instead. However, you will have trouble: With the current design, your code would become overly complicated if you tried to represent even the most well-known ones. Morwenn Morwenn 15k 2 48 This deal-braking mechanism has to be consistent, which is difficult to realize otherwise comparing the names is not possible, as there could be ties here as well, and I don't want to untangle those love triangles.

Are you the one who assigned this task? Maybe the intended audience is exactly how the problem states it. Next time I write a program to sort football fans and you will object that people who hate football and like basketball instead should be also included? Nothing in your answer actually answers the question, you just argue that the question should be changed to look for a solution for a completely different problem.

This is codreview, not political sciences. For fun actually those are social sciences by the way, not political sciences. I expected that I would get that kind of answers and was actually waiting for them. Dan Dan 1 3. If it wasn't sufficient, you should have added additional details that I could then come back and edit my response. No need to create a whole new question. If you need a loop, then just do what I told you in the last post and put it inside a loop.

Related Questions Can someone teach me how to write classes, methods, fields and constructors in Java? How to write three classes each with a main method in java program? In Java, how to write a class with two instance methods? Write a Java class with a main method that declares an integer and initializes it to a five-digit number. Answer Questions How do you analyze the convergence of a recursive algorithm, especially when it involves conditionals? What are the effects of self of self modifying code on CPU cache? Is there anywhere i can post a blog, like not a whole new website like Wix or Weebly or whatever.

Your Answer

How do you build a hotel booking platform? If you had written The Art of the Deal, would you have asked for wall funding when Republicans controlled the House and Senate? Would we have all this technology if not for people sacrificing their lives sometimes standing up for views that were not always acceptable?

Do you need too update Java? Which languages should I learn to be a hacker?