0

I am having a problem with my program it has NO syntax errors but when I right click the class the "void main String [] args" option dosent appear so I cannot test my program I have no idea what it wrong PLEASE HELP

import java.awt.*;
import java.awt.event.*;
public class DATE
{
private static class ActionHandler implements ActionListener

{
public void actionPerformed(ActionEvent event)
{
       

    int month;
   month = Integer.valueOf(inputFieldmonth.getText()). intValue();
    
    inputFieldmonth.setText("");
    
    if (month==1)
    {
        System.out.println("January");
    }
    else if (month==2)
    {
        System.out.println("February");
    }
    else if (month==3)
    {
        System.out.println("March");
    }
    else if (month==4)
    {
        System.out.println("April");
    }
    else if (month== 5)
    {
        System.out.println("May");
    }
    else if (month==6)
    {
        System.out.println("June");
    }
    else if (month==7)
    {
        System.out.println("July");
    }
    else if (month ==8)
    {
        System.out.println("August");
    }
    else if (month==9)
    {
        System.out.println("September");
    }
    else if (month==10)
    {
        System.out.println("October");
    }
    else if (month==11)
    {
        System.out.println("November");
    }
    else if (month==12)
    {
        System.out.println("December");
    }
       else if (month>12)
    {
        System.out.println("There are only 12 months in a year");
    }

    int day;
    day = Integer.valueOf(inputFieldday.getText()). intValue();
    
    inputFieldday.setText("");
    
    if (day==1)
    {
        System.out.println("First");
    }
    else if (day==2)
    {
        System.out.println("Second");
    }
    else if (day==3)
    {
        System.out.println("Third");
    }
    else if (day==4)
    {
        System.out.println("Fourth");
    }
    else if (day== 5)
    {
        System.out.println("Fifth");
    }
    else if (day==6)
    {
        System.out.println("Sixth");
    }
    else if (day==7)
    {
        System.out.println("Seventh");
    }
    else if (day ==8)
    {
        System.out.println("Eighth");
    }
    else if (day==9)
    {
        System.out.println("Ninth");
    }
    else if (day==10)
    {
        System.out.println("Tenth");
    }
    else if (day==11)
    {
        System.out.println("Eleventh");
    }
    else if (day==12)
    {
        System.out.println("Twelth");
    }
    else if (day==13)
    {
        System.out.println("Thirteenth");
    }
    else if (day==14)
    {
        System.out.println("Fourteenth");
    }
    else if (day==15)
    {
        System.out.println("Fifteenth");
    }
    else if (day==16)
    {
        System.out.println("Sixteenth");
    }
    else if (day== 17)
    {
        System.out.println("Seventeenth");
    }
    else if (day==18)
    {
        System.out.println("Eighteenth");
    }
    else if (day==19)
    {
        System.out.println("Ninteenth");
    }
    else if (day ==20)
    {
        System.out.println("Twentyith");
    }
    else if (day==21)
    {
        System.out.println("Twenty-First");
    }
    else if (day==22)
    {
        System.out.println("Twenty-Second");
    }
    else if (day==23)
    {
        System.out.println("Twenty-Third");
    }
    else if (day==24)
    {
        System.out.println("Twenty-Fourth");
    }

    else if (day==25)
    {
        System.out.println("Twenty-Fifth");
    }
    else if (day==26)
    {
        System.out.println("Twenty-Sixth");
    }
    else if (day==27)
    {
        System.out.println("Twenty-Seventh");
    }
    else if (day ==28)
    {
        System.out.println("Twenty-Eighth");
    }
    else if (day==29)
    {
        System.out.println("Twenty-Ninth");
    }
    else if (day==30)
    {
        System.out.println("Thirtyith");
    }
    else if (day==31)
    {
        System.out.println("Thirty-First");
    }
     else if (day>31)
    {
        System.out.println("There are only 31 days in a month");
    }
   
    
    int year;
  year =  Integer.valueOf(inputFieldyear.getText()). intValue();
    
    inputFieldyear.setText("");
   
    if (year==10)
    {
        System.out.println("One Thousand");
    }
    else if (year==11)
    {
        System.out.println("Eleven-Hundred");
    }
    else if (year==12)
    {
        System.out.println("Tweleve-Hundred");
    }
    else if (year==13)
    {
        System.out.println("Thirteen-Hundred");
    }
    else if (year==14)
    {
        System.out.println("Fourteen-Hundred");
    }
    else if (year==15)
    {
        System.out.println("Fifteen-Hundred");
    }
    else if (year==16)
    {
        System.out.println("Sixteen-Hundred");
    }
    else if (year==17)
    {
        System.out.println("Seventeen-Hundred");
    }
    else if (year==18)
    {
        System.out.println("Eighteen-Hundred");
    }
    else if (year==19)
    {
        System.out.println("Nineteen-Hundred");
    }
    else if (year==20)
    {
        System.out.println("Two-Thousand");
    }
    else if (year==21)
    {
        System.out.println("TwentyOne-Hundred");
    }
    else if (year==22)
    {
        System.out.println("TwentyTwo-Hundred");
    }
    else if (year==23)
    {
        System.out.println("TwentyThree-Hundred");
    }
    else if (year>=24)
    {
        System.out.println("Year exceecds Program");
    }

    int yearr;
   yearr = Integer.valueOf(inputFieldyearr.getText()). intValue();
    
    inputFieldyearr.setText("");
    
    if (yearr==01)
    {
        System.out.println(" and one");
    }
    else if (yearr==02)
    {
        System.out.println("and two");
    }
    else if (yearr==03)
    {
        System.out.println("and three");
    }
    else if (yearr==04)
    {
        System.out.println("and four");
    }
    else if (yearr== 05)
    {
        System.out.println("and five");
    }
    else if (yearr==06)
    {
        System.out.println("and six");
    }
    else if (yearr==07)
    {
        System.out.println("and seven");
    }
    else if (yearr==8)
    {
        System.out.println("and eight");
    }
    else if (yearr==9)
    {
        System.out.println("and nine");
    }
    else if (yearr==10)
    {
        System.out.println("and ten");
    }
    else if (yearr==11)
    {
        System.out.println("and eleven");
    }
    else if (yearr==12)
    {
        System.out.println("and twelve");
    }
    else if (yearr==13)
    {
        System.out.println("and thirteen");
    }
    else if (yearr==14)
    {
        System.out.println("and fourteen");
    }
    else if (yearr==15)
    {
        System.out.println("and fifteen");
    }
    else if (yearr==16)
    {
        System.out.println("and sixteen");
    }
    else if (yearr== 17)
    {
        System.out.println("and seventeen");
    }
    else if (yearr==18)
    {
        System.out.println("and eighteen");
    }
    else if (yearr==19)
    {
        System.out.println("and nineteen");
    }
    else if (yearr ==20)
    {
        System.out.println("and twenty");
    }
    else if (yearr==21)
    {
        System.out.println("and twenty one");
    }
    else if (yearr==22)
    {
        System.out.println("and twenty two");
    }
    else if (yearr==23)
    {
        System.out.println("and twenty three");
    }
    else if (yearr==24)
    {
        System.out.println("and twenty four");
    }

    else if (yearr==25)
    {
        System.out.println("and twenty five");
    }
    else if (yearr==26)
    {
        System.out.println("and twenty six");
    }
    else if (yearr==27)
    {
        System.out.println("and twenty seven");
    }
    else if (yearr ==28)
    {
        System.out.println("and twenty eight");
    }
    else if (yearr==29)
    {
        System.out.println("and twenty nine");
    }
    else if (yearr==30)
    {
        System.out.println("and thirty  ");
    }
    else if (yearr==31)
    {
        System.out.println("and thirty one");
    }
    else if (yearr==32)
    {
        System.out.println("and thirty two");
    }
    else if (yearr==33)
    {
        System.out.println("and thirty three");
    }
    else if (yearr==34)
    {
        System.out.println("and thirty four");
    }
    else if (yearr==35)
    {
        System.out.println("and thirty five");
    }
    else if (yearr== 36)
    {
        System.out.println("and thirty six");
    }
    else if (yearr==37)
    {
        System.out.println("and thirty seven");
    }
    else if (yearr==38)
    {
        System.out.println("and thirty eight");
    }
    else if (yearr ==39)
    {
        System.out.println("and thirty nine");
    }
    else if (yearr==40)
    {
        System.out.println("and forty ");
    }
    else if (yearr==41)
    {
        System.out.println("and forty one");
    }
    else if (yearr==42)
    {
        System.out.println("and forty two");
    }
    else if (yearr==43)
    {
        System.out.println("and forty three");
    }
    else if (yearr==44)
    {
        System.out.println("and forty four");
    }
    else if (yearr==45)
    {
        System.out.println("and forty five");
    }
    else if (yearr==46)
    {
        System.out.println("and forty six");
    }
    else if (yearr==47)
    {
        System.out.println("and forty seven");
    }
    else if (yearr== 48)
    {
        System.out.println("and forty eight");
    }
    else if (yearr==49)
    {
        System.out.println("and forty nine");
    }
    else if (yearr==50)
    {
        System.out.println("and fifty ");
    }
    else if (yearr ==51)
    {
        System.out.println("and fifty one");
    }
    else if (yearr==52)
    {
        System.out.println("and fifty two");
    }
    else if (yearr==53)
    {
        System.out.println("and fifty three");
    }
    else if (yearr==54)
    {
        System.out.println("and fifty four");
    }
    else if (yearr==55)
    {
        System.out.println("and fifty five");
    }

    else if (yearr==56)
    {
        System.out.println("and twenty six");
    }
    else if (yearr==57)
    {
        System.out.println("and fifty seven");
    }
    else if (yearr==58)
    {
        System.out.println("and fifty eight");
    }
    else if (yearr ==59)
    {
        System.out.println("and fifty nine");
    }
    else if (yearr==60)
    {
        System.out.println("and sixty ");
    }
    else if (yearr==61)
    {
        System.out.println("and sixty one  ");
    }
    else if (yearr==62)
    {
        System.out.println("and sixty two");
    }
    
    else if (yearr==63)
    {
        System.out.println("and sixty three");
    }
    else if (yearr==64)
    {
        System.out.println("and sixty four");
    }
    else if (yearr==65)
    {
        System.out.println("and sixty five");
    }
    else if (yearr== 66)
    {
        System.out.println("and sixty six");
    }
    else if (yearr==67)
    {
        System.out.println("and sixty seven");
    }
    else if (yearr==68)
    {
        System.out.println("and sixty eight");
    }
    else if (yearr ==69)
    {
        System.out.println("and sixty nine");
    }
    else if (yearr==70)
    {
        System.out.println("and seventy ");
    }
    else if (yearr==71)
    {
        System.out.println("and seventy one");
    }
    else if (yearr==72)
    {
        System.out.println("and seventy two");
    }
    else if (yearr==73)
    {
        System.out.println("and seventy three");
    }
    else if (yearr==74)
    {
        System.out.println("and seventy four");
    }
    else if (yearr==75)
    {
        System.out.println("and seventy five");
    }
    else if (yearr==76)
    {
        System.out.println("and seventy six");
    }
    else if (yearr==77)
    {
        System.out.println("and seventy seven");
    }
    else if (yearr== 78)
    {
        System.out.println("and seventy eight");
    }
    else if (yearr==79)
    {
        System.out.println("and seventy nine");
    }
    else if (yearr==80)
    {
        System.out.println("and eighty ");
    }
    else if (yearr ==81)
    {
        System.out.println("and eighty one");
    }
    else if (yearr==82)
    {
        System.out.println("and eighty two");
    }
    else if (yearr==83)
    {
        System.out.println("and eighty three");
    }
    else if (yearr==84)
    {
        System.out.println("and eighty four");
    }
    else if (yearr==85)
    {
        System.out.println("and eighty five");
    }

    else if (yearr==86)
    {
        System.out.println("and eighty six");
    }
    else if (yearr==87)
    {
        System.out.println("and eighty seven");
    }
    else if (yearr==88)
    {
        System.out.println("and eighty eight");
    }
    else if (yearr ==89)
    {
        System.out.println("and eighty nine");
    }
    else if (yearr==90)
    {
        System.out.println("and ninety ");
    }
    else if (yearr==91)
    {
        System.out.println("and ninety one");
    }
    else if (yearr==92)
    {
        System.out.println("and ninety two");
    }
    else if (yearr==93)
    {
        System.out.println("and ninety three");
    }
    else if (yearr==94)
    {
        System.out.println("and ninety four");
    }
    else if (yearr==95)
    {
        System.out.println("and ninety five");
    }
    else if (yearr==96)
    {
        System.out.println("and ninety six");
    }
    else if (yearr== 97)
    {
        System.out.println("and ninety seven");
    }
    else if (yearr==98)
    {
        System.out.println("and ninety eight");
    }
    else if (yearr==99)
    {
        System.out.println("and ninety nine");
    }
    else if (yearr>99)
    {
        System.out.println("number must be a two digit number e.g: '01' or '34'");
    }
    
    
}
private static Frame inputFrame;

private static Label outputLabelmonth;
private static Label outputLabelday;
private static Label outputLabelyear;
private static Label outputLabelyearr;

private static TextField inputFieldmonth;
private static TextField inputFieldday;
private static TextField inputFieldyear;
private static TextField inputFieldyearr;

private static int month;    
private static int day;
private static int year;
private static int yearr;


public static void main (String[] args)
{

Label entryLabelmonth; 
Label entryLabelday; 
Label entryLabelyear; 
Label entryLabelyearr;
Button finish;         
ActionHandler action;  




  inputFrame = new Frame();     
  
  outputLabelmonth = new Label("");
  entryLabelmonth= new Label("");
  inputFieldmonth = new TextField("Country Code",3); 
  
  outputLabelday = new Label(""); 
  entryLabelday = new Label("");
  inputFieldday = new TextField("Area Code",3); 
  
  outputLabelyear = new Label("");
  entryLabelyear = new Label("");
  inputFieldyear = new TextField("Local Number",7); 
  
  outputLabelyearr = new Label(""); 
  entryLabelyearr = new Label("");
  inputFieldyearr = new TextField("Local Number",7); 


/** creates a button named finish*/
finish = new Button("Finish"); 
finish.setActionCommand("finish");
action = new ActionHandler();
finish.addActionListener(action); 




    inputFrame.setLayout(new GridLayout(1,3));   // grid layout for the frame
    
    // adds input fields to the entry fields
              
     
    inputFrame.add(inputFieldmonth);
    inputFrame.add(inputFieldday);
    inputFrame.add(inputFieldyear);
    inputFrame.add(inputFieldyearr);
    
    // button is pressed and out puts the outputLabels below
    inputFrame.add(finish);
    
    inputFrame.add(outputLabelmonth);
    inputFrame.add(entryLabelmonth); 
    
    inputFrame.add(outputLabelday);
    inputFrame.add(entryLabelday); 
    
    inputFrame.add(outputLabelyear);
    inputFrame.add(entryLabelyear);
    
    inputFrame.add(outputLabelyearr);
    inputFrame.add(entryLabelyearr); 
        
    
            inputFrame.pack(); //packs the frame
            inputFrame.show();//shows the frame
inputFrame.addWindowListener(new WindowAdapter()  //adds window listener and adapter to frame
{
public void windowClosing(WindowEvent event)  //closes the frame
{
inputFrame.dispose();
System.exit(0);
}
});
}
} 
}

/** the program is completed and finished
* *****************************************************************************************************************
*/

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by kvass
0

Use code tags -- it makes reading your code easier for ppl so they can help you with the problem. Also, the long else-if series is not very effective coding -- instead you could have made 2 arrays of strings with names for the tens digits and names for the ones digits so it would be like this:

String[] ones = {"","One","'Two","Three","Four","Five","Six","Seven","Eight","Nine"}
String[] tens = {"","Ten","Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety"}

switch(yearr)
{
    case 11:System.out.println("Eleven-Hundred");break;
    case 12:System.out.println("Twelve-Hundred");break;
    case 13:System.out.println("Thirteen-Hundred");break;
    case 14:System.out.println("Fourteen-Hundred");break;
    case 15:System.out.println("Fifteen-Hundred");break;
    case 16:System.out.println("Sixteen-Hundred");break;
    case 17:System.out.println("Seventeen-Hundred");break;
    case 18:System.out.println("Eighteen-Hundred");break;
    case 19:System.out.println("Nineteen-Hundred");break;
    default:
        if (yearr<99 && yearr>0)
            System.out.println(tens[yearr/10]+" "+ones[yearr%10]+"-Hundred");
        else
            System.out.println("Invalid number");
}
//Remainder of code

But other than that stylistic note, if you want help I suggest code tags -- I can't read your code this way

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.