Skip to content

Instantly share code, notes, and snippets.

@jsc230
jsc230 / AgeCalculatorApp
Created December 31, 2012 06:17
This is from exercise 13-2 (using dates) in Murach's Java Programming 4. I have the program written but the age comes out incorrect. If you use my birthday Feb 17, 1982 it gives an age of 662. I checked the math by hand and it should give the correct result of 30. If you look at the calculateAge() function I have outputs for each step of the cal…
import java.util.*;
import java.text.DateFormat;
public class AgeCalculatorApp
{
private static Date today = new Date();
private static GregorianCalendar gregBirthDate = new GregorianCalendar();
private static Date birthDate = new Date();
private static DateFormat formattedDate = DateFormat.getDateInstance(DateFormat.SHORT);