lundi 5 février 2018

create arrays to save data

In this program, I am required to use arrays to save at most 20 country codes. How can I correct it to save the country name and codes?

   public class countryCodeSystem {

static String[] nameRec = new String[20];   
static String []numRec = new String[20];  
}


public static void storeCountryCode() {                                 

         for(int i=0; i<=19; i++) 
             System.out.println("Add country name:");
         String countryName = input.nextLine();
         countryNameRec[countryName];
         System.out.println("Add country code");
         String coutryCode = in.nextLine();
         countryCodeRec[countryCode];
         System.out.println("Save" + countryName + countryCode);            

         break;
          else {
              System.out.println("Full");
      }
     }

Aucun commentaire:

Enregistrer un commentaire