Issue Details (XML | Word | Printable)

Key: FIRSTCUP-12
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Ian Evans
Reporter: Johann_Kropf
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
firstcup

Method getAgeDifference of DukesBirthdayBean returns wrong value

Created: 13/May/13 09:07 AM   Updated: 11/Jun/13 08:56 PM   Resolved: 11/Jun/13 08:56 PM
Component/s: examples
Affects Version/s: current
Fix Version/s: 7.0.1

Time Tracking:
Not Specified

Environment:

Netbeans 7.3, Your Firstcup Cup, April 2012, Windows 7 64bit


Tags:
Participants: Ian Evans and Johann_Kropf


 Description  « Hide

The method getAgeDifference of the enterprise bean class DukesBirthdayBean returns wrong values. That's because 1. theirBirthday and dukesBirthday are not at the same year when compared and 2. if the user is younger (<0) and dukesBirthday is after the user's one the ageDifference should be reduced.

I have added the following code:

// Bring the dates to the same year (the dukes Year)
theirBirthday.add(Calendar.YEAR, ageDifference);

// Check to see if Duke's birthday occurs before the user's when the user is older. If so,
// subtract one from the age difference
if (dukesBirthday.before(theirBirthday) && (ageDifference > 0)) { ageDifference--; }
// Check to see if Duke's birthday occurs after the user's when the user is younger. If so,
// subtract one from the age difference
if (dukesBirthday.after(theirBirthday) && (ageDifference < 0)) { ageDifference++; }



Ian Evans made changes - 11/Jun/13 08:55 PM
Field Original Value New Value
Assignee Ian Evans [ ievans ]
Ian Evans made changes - 11/Jun/13 08:55 PM
Status Open [ 1 ] In Progress [ 3 ]
Ian Evans added a comment - 11/Jun/13 08:56 PM

Updated the source with the fix, and it is in version 7.0.1, in the Java EE 7 SDK.


Ian Evans made changes - 11/Jun/13 08:56 PM
Status In Progress [ 3 ] Resolved [ 5 ]
Fix Version/s 7.0.1 [ 15221 ]
Resolution Fixed [ 1 ]