The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 305 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Attached file already runs. I am trying to change the states that have two names such as New_York, to not need to use the "_" or underscore.
Â
Additionally, I am trying to add a summary to the end of this program. If 4 states are asked, then by typing "none", the program says "***thank you****" and below thank you, it states: "A summary report for each state, bird and flower is:" then it lists each below this statement separated by commas.
Â
After the number of states is listed, the program should say "Please come back and visit again later!". As an example below:
Â
*******Thank you*******
A summary report for each state, bird and flower is:
Delaware, Blue Hen Chicken, Beach Blossumimport java.util.Scanner;
public class StateSymbol {
   public static int getInfo(String stateSymbol[][],String state)
  {
      int position = -1;
      boolean found = false;
      for (int index=0; index<stateSymbol.length && !found; index++)
      {
          if(stateSymbol[index][0].equalsIgnoreCase(state))
              position=index;          Â
      }
      return position;
  }
   public static void main(String[] args) {
       Scanner userInput = new Scanner(System.in);
       String[][] stateInformation = new String[][] {
           {"Alabama", "Yellowhammer", "Camelia"},
           {"Alaska", "Willow Ptarmigan", "Forget-Me-Not"},
           {"Arizona", "Cactus Wren", "Saguaro Cactus Blossom"},
           {"Arkansas", "Mockingbird", "Apple Blossom"},
           {"California", "California Valley Quail", "Golden Poppy"},
           {"Colorado", "Lark Bunting", "Rocky Mountain Columbine"},
           {"Connecticut", "Robin", "Mountain Laurel"},
           {"Delaware", "Blue Hen Chicken", "Peach Blossom"},
           {"Florida", "Mockingbird", "Orange Blossom"},
           {"Georgia", "Brown Thrasher", "Cherokee Rose"},
           {"Hawaii", "Nene", "Hawaiian Hibiscus"},
           {"Idaho", "Mountain Bluebird", "Syringa, mock orange"},
           {"Illinois", "Cardinal", "Violet"},
           {"Indiana", "Cardinal", "Peony"},
           {"Iowa", "Eastern Goldfinch", "Wild Praire Rose"},
           {"Kansas", "Western Meadowlark", "Sunflower"},
           {"Kentucky", "Cardinal", "Goldenrod"},       Â
           {"Louisiana", "Eastern Brown Pelican", "Magnolia"},
           {"Maine", "Chickadee", "Pine Cone and Tassel"},
           {"Maryland", "Baltimore Oriole", "Black-Eyed Susan"},
           {"Massachusetts", "Chickadee", "Mayflower"},
           {"Michigan", "Robin", "Apple Blossom"},
           {"Minnesota", "Common Loon", "Pink and White Lady's Slipper"},
           {"Mississippi", "Mockingbird", "Magnolia"},
           {"Missouri", "Bluebird", "Hawthorn"},
           {"Montana", "Western Meadowlark", "Bitterroot"},
           {"Nebraska", "Western Meadowlark", "Goldenrod"},
           {"Nevada", "Mountain Bluebird", "Sagebrush"},
           {"New_Hampshire", "Purple Finch", "Purple Lilac"},
           {"New_Jersey", "Eastern Goldfinch", "Violet"},
           {"New_Mexico", "Roadrunner", "Yucca Flower"},
           {"New_York", "Bluebird", "Rose"},
           {"North_Carolina", "Cardinal", "Flowering Dogwood"},
           {"North_Dakota", "Western Meadowlark", "Wild Prairie Rose"},
           {"Ohio", "Cardinal", "Scarlet Carnation"},
           {"Oklahoma","Scissor-tailed Flycatcher","Oklahoma Rose"},        Â
           {"Oregon", "Western Meadowlark", "Oregon Grape"},
           {"Pennsylvania", "Ruffed Grouse", "Mountain Laurel"},
           {"Rhode_Island", "Rhode Island Red", "Violet"},       Â
           {"South_Carolina", "Great Carolina Wren", "Yellow Jessamine"},
           {"South_Dakota", "Ring-necked Pheasant", "Pasque Flower"},
           {"Tennessee", "Mockingbird", "Purple Passionflower"},
           {"Texas", "Mockingbird", "Bluebonnet Sp."},
           {"Utah", "Common American Gull", "Sego Lily"},
           {"Vermont", "Hermit Thrush", "Red Clover"},
           {"Virginia","Cardinal"," American Dogwood"},
           {"Washington", "Willow Goldfinch", "Coast Rhododendrum"},
           {"West Virginia", "Cardinal", "Rhododendron"},
           {"Wisconsin", "Robin", "Wood Violet"},
           {"Wyoming", "Western Meadowlark", "Indian Paintbrush"}
       };
       while(true) {
           System.out.println("Enter a State Name or None to exit:");
           String stateName = userInput.next();
           if(stateName.equalsIgnoreCase("None")) {
               System.exit(0);
           }
           else {
               int position = getInfo(stateInformation, stateName);
               if(position != -1) {
                   System.out.println("Bird: " + stateInformation[position][1]);
                   System.out.println("Flower: " + stateInformation[position][2]);               Â
               }
               else {
                   System.out.println("Invalid State Entered");
               }            Â
           }        Â
       }
   }
}
Pennsylvania, Roughed Grouse, Mountain Laurel
Please come back and visit again later!
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly