Heyas, I'm struggling to come up with some working code for a piece of software I've to make. I know it's got something to do with Arrays, or array lists, which just so happen to be the one thing I missed in C and Java! Student life, eh? :P

Anyway, the thing I've to do is write a piece of software that permits a user to enter up to 100 contract details (ie. name, number, expected completion date). Although the user to enter an 'actual' completion date for the contracts, and finally, determines whether each contract was completed on schedule, and prints out the contracts completed late.

Any help would be great and yeah, I know it's a bit to ask, but, you don't ask, you don't get right? :P

The following is the code I've came up with so far, Apologies for the lack of indentation, it reset it all once posted:

import java.util.Scanner;

public class Contract {

class ContractArray {public static void main(String[] args) {String[] contArray;              //Declares string of arrays
contArray = new String[100];	
class Date
{	// propertiesprivate int day, month, year;

	 // methodspublic void readDate(){
	 // prompts for and reads in a Date from the keyboard
	          	Scanner sc = new Scanner(System.in);do
	          {	System.out.print("Enter day: ");	day = sc.nextInt();System.out.print("Enter month: ");month = sc.nextInt();System.out.print("Enter year: ");year = sc.nextInt();if (!validDate())System.out.println("Date not valid! Try again...");
	          }while (!validDate());

	          	public boolean after(Date D){		
	          	// checks if a Date is after Date D
	          		if (year > D.year)
	          			return true;
	          		else if ((year == D.year) && (month > D.month))
	          			return true;
	          		else if ((year == D.year) && (month == D.month) && (day > D.day))
	          			return true;
	          			return false;	

	          	public void printDate() {
	          		System.out.println(day + "/" + month + "/" + year);
	          	public boolean validDate()
	          	{	if (!validYear(year))
	          		 	return false;
	          		else if (!validMonth(month))
	          			return false;
	          		else if	(!validDay(day,month))
	          			return false;
	          			return true;

	          	private boolean validYear(int y)
	          	{	if ((y < 1990) || (y > 2100))
	          			return false;
	          			return true;
	          	private boolean validMonth(int m)
	          	{	if ((m < 0) || (m > 12))
	          			return false;
	          			return true;
	          	private boolean validDay(int d, int m)
	          	{	if ((d < 0) || (d > daysinMonth(m)))
	          			return false;
	          			return true;
	          	private int daysinMonth(int m)
	          	{	int NumDays;
	          		{	case 1:case 3:case 5:case 7: 
	          			case 8:case 10:case 12 : NumDays = 31;
	          			case 4:case 6:case 9:case 11: 
	          									NumDays = 30;
	          			case 2 : NumDays = 28;
	          			default: NumDays =  0;
	          		return NumDays;
} // end of class Date

public class contractRecord {
		String custName;
		String contractNum;
		int cost;
		int exCompDate;
	//	int actCompDate;
	Scanner sc = new Scanner(System.in);
	System.out.println("Please enter Customer Name: ");
	custName = sc.nextString();
    System.out.println("Please enter Contract Number: ");
	contractNum = sc.nextString();
    System.out.println("Please enter Expected cost: ");
	cost = sc.nextInt	();
    System.out.println("Please enter Expected completion date (DDMMYYYY): ");
	exCompDate = sc.nextInt();
    //	System.out.println("Please enter Actual completion date (DDMMYYYY): ");		// Not meant for here.
	//	actCompDate = sc.nextInt();
//Run Date Class
 	//if late
	System.out.println("********* Contract Number: " + contractNum[]);
	System.out.println("Customer: " + custName);
	System.out.println("Expected Date of Completion: " + exCompDate);
	System.out.println("Actual Date of Completion: " +actCompDate);
	System.out.println("Cost: " + cost);


Last edited by shabbir; 21Jul2008 at 16:57.. Reason: Code block