I have been using JAVA for a whole two weeks now. I am enrolled in CSC 148 at my local college.
I am supposed to write a program that asks the user for his or her age and replies with the day of the week on which he or she was born.
I am familiar with the I/O, but cannot figure out to convert from a date
(ie. 07/04/1776) to a day (ie. Saturday).
Here is my current code:
/*
Ask the user for his or her birthdate and return with the day of the week
on which he or she was born.
*/
import javax.swing.*;
import java.sql.*; //For Return Date
class Exercise2_29 {
public static void main( String[] args ) {
//Input user birth date
String bdate;
bdate = JOptionPane.showInputDialog(null, "What is your birth date?
(MM/DD/YYYY)");
//Convert user birth date to day of week
}
}
Note: I can only use the java.util or java.sql classes. The GregorianCalendar class has not yet been officially taught and, therefore, can't be used.
Also, is the code I currently have good. Do I need to import any other classes, or add any more strings?
Thanks in advance for any help.
bcheath_1