Write a Java program that will generate random four letter words. The words must consist of only lower case letters. The program will prompt the user to enter the number of words to generate. The program should request that the user enter a number between 1 and 500 and ensure that they comply. It will then generate the appropriate number of words neatly displaying them separated by spaces 10 words to a line. After the words are displayed the program must display the first word and also the last word if they were sorted alphabetically.

PLz help i m trying it but couldnt make it rite.plz urgent help.thnx in advance.

public class randon11 {
  
  public static void main(String[] args){
    
    double  i;
    int nbrwords,hold, count=0;
    char word;
    String word1,word2;
    
    TextIO.put("Enter the Number of words to generate :");
    nbrwords=TextIO.getlnInt();
   // while(count !=nbrwords){
    for(int j=1;j<=4;j++){
    i=5*Math.random()+(int)'a';
    //hold=(int)i;
   
    word=(char)i;
    
     //word1=(cha)

Recommended Answers

All 3 Replies

This is not urgent.

i solved it already thnx for not replying

@Sunny89 not sure where you got offended as in reality what ever is urgent to you is related to you and irrelevant to us. It would be different story if we are in same team which has to finish a certain task...

Beside if you solved your problem it is always nice to share solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.