QUOTE(William_Wilson @ 3 Oct, 2007 - 02:40 PM)

Please do not post in all capitals, it will not increase your replies in a good way.
We do not provide answers, we are a community to help programmers. Please make an honest attempt and we will help you with errors and incorrect output.
Please read the rules for further clarification.
well, First of all, Thanks for your suggestion.
I know using SimpleDateFormat is problably the best way to do it, but my teacher hasn't taught it yet and i assume that she doesn't want me to use it as well. Moreover, I heard she said in the class that just using Scanner and If/else logic. But that is a problem. java i have studied in my last Lab looks like this.
// ****************************************************************
// KEY Charge.java
//
// Determine interest and balance for charge card
//
// ****************************************************************
import java.util.Scanner;
import java.text.NumberFormat;
public class Charge
{
public static void main(String[] args)
{
// Declare variables here
double PreBalance,AddCharge,Inr, NewBalance,MinPayment;
//Get inputs from user
Scanner scan = new Scanner(System.in);
System.out.println("please input your Previous Balance: ");
PreBalance = scan.nextDouble();
System.out.println("please input your Additional Charge: ");
AddCharge = scan.nextDouble();
//Calculate interest owed
if (PreBalance == 0)
{
Inr = 0;
}
else
{
Inr = (PreBalance + AddCharge) * 0.02;
}
//Calculate new balance
NewBalance = PreBalance + AddCharge + Inr;
//Calculate minimum payment
if (NewBalance < 50)
{
MinPayment = NewBalance;
}
else
{
if (50 < NewBalance && NewBalance <= 300)
{
MinPayment = 50;
}
else
{
MinPayment = NewBalance * 0.2;
}
}
// print output
NumberFormat priceFormat = NumberFormat.getCurrencyInstance();
System.out.println(" CS CARD International Statement");
System.out.println( "===============================");
System.out.println( "Previous Balance: " +
priceFormat.format(PreBalance));
System.out.println( "Additional Charge: " +
priceFormat.format(AddCharge));
System.out.println( "Interest: "
+ priceFormat.format(Inr));
System.out.println( " ");
System.out.println( "New Balance: "
+ priceFormat.format(NewBalance));
System.out.println( " ");
System.out.println( "Minimum Payment: "
+ priceFormat.format(MinPayment));
}
}
If it is about integer, i understand how to do it very well. But in this assignment, there are many problems i cannot handle it such as
1. After taking a String as input from keybord, representing a date, parse the input into the form: mm/dd/yyyy
Problem is how can i take a String as input to prompt user (by scanner) and then parse it into the form: mm/dd/yyyy
2. If the user enter the month that is between 1 and 12 such as 1 or 01 how can i convert it to its complete name (January) .
I have tried many way and searched from many website, but they always reccommended me to use SimpleDateformat. how can i use it when my teacher said don't
Here is my source code i have been working on it so far.
/*
program that takes a String as input from the keyboard, representing a date
and parse the input into the form: mm/dd/yyyy.
*/
import java.util.*;
public class Assignment3
{
public static void main(String[] args)
{
// Declaring variables
String monthInput, dayInput, yearInput;
String January, February, March, April, May, June, July, August, September, October, November, December;
// Get input from user
Scanner scan = new Scanner(System.in);
System.out.print("Please enter a month : ");
monthInput = scan.next();
System.out.print("Please enter a day : ");
dayInput = scan.next();
System.out.print("Please enter a year : ");
yearInput = scan.next();
if monthInput >= 1 && monthInput <= 12)
{
January = "1"; // || January = "01";
February = "2";
March = "3";
April = "4";
May = "5";
June = "6";
July = "7";
August = "8";
September = "9";
October = "10";
November = "11";
December = "12";
}
else
{
System.out.println (" The month you provided is not valid ");
System.out.println (" Please correct it" "," "and then try again ");
}
I knew i did many mistake but please how to do it correctly. I got a long way to go to finished this such as
1. Validate that the day put is valid for the month
2. if the year entered has two charaters, convert it to an int, add 2000 to it. if has four just convert to an int
Finally, after everythng finished, it should be like this
Enter the date: 1/1/00 // user put it
your date is: January 1, 2000 // the outcome i want to come out.
So please guide me how to do it. At least, about problem the month (how to convert it to its complete name)
Thank so much