Advertisement
Shanix

Untitled

Mar 2nd, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. if (aLength == 0) {
  2. if (bLength == 0) {
  3. return s;
  4. } else if (bLength == 1) {
  5. return s + "'s parent.";
  6. } else if (bLength == 2) {
  7. return s + "'s grandparent.";
  8. } else if (bLength == 3) {
  9. return s + "'s great grandparent.";
  10. } else {
  11. s += "'s ";
  12. for (int i = 0; i < bLength - 2; i++) {
  13. s += "great ";
  14. }
  15. s += "grandparent";
  16. return s;
  17. }
  18. } else if (aLength == 1) {
  19. if (bLength == 0) {
  20. return s + "'s child";
  21. } else if (bLength == 1) {
  22. return s + "'s sibling.";
  23. } else if (bLength == 2) {
  24. return s + "'s aunt/uncle.";
  25. } else {
  26. s += "'s ";
  27. for (int i = 0; i < bLength - 2; i++) {
  28. s += "great ";
  29. }
  30. s += "aunt/uncle";
  31. return s;
  32. }
  33. } else if (aLength >= 2) {
  34. if (aLength == 2 && bLength == 0) {
  35. return s + "'s grandchild";
  36. }
  37. if (bLength == 1) {
  38. s += "'s ";
  39. for (int i = 0; i < aLength - 2; i++) {
  40. s += "great ";
  41. }
  42. s += "niece/nephew";
  43. return s;
  44. } else if (bLength >= 2) {
  45. return s + "'s " + (Math.min(bLength, aLength) - 1) + "th cousin " + Math.abs(aLength - bLength) + " times removed.";
  46. }
  47. if (bLength == 0 && aLength >= 3) {
  48. s += "'s ";
  49. for (int i = 0; i < aLength - 2; i++) {
  50. s += "great ";
  51. }
  52. s += "grandchild";
  53. return s;
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement