SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 4 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 13 Dec 2017 My Price 10.00

Store the State information in a multidimensional array

I need to add a "summary report" function to this code.

"

 Hint: Store the State information in a multidimensional array. The program should continue to prompt the user to enter a state until “None” is entered. After all States have been entered by the user, the program should display a summary of the results. You will need to do some research to find the State birds and flowers.

Here is a sample run:

Enter a State or None to exit: Maryland Bird: Baltimore Oriole Flower: Black-eyed Susan Enter a State or None to exit: Delaware Bird: Blue Hen Chicken Flower: Peach Blossom Enter a State or None to exit: None



**** Thank you *****

A summary report for each State, Bird, and Flower is: Maryland, Baltimore Oriole, Black-eyed Susan Delaware, Blue Hen Chicken, Peach Blossom Please visit our site again!

"





import java.util.Scanner;



public class StatesDataEntry {

  /**

   * the command line arguments

   */

  public static int getInfo(String statesDataEntry[][],String state)

  {

    int position = -1;

    boolean found = false;

    for (int index=0; index<statesDataEntry.length && !found; index++)

    {

      if(statesDataEntry[index][0].equalsIgnoreCase(state))

        position=index;      

    }

    return position;

  }







  public static void main(String[] args) {

    // TODO code application logic here

    Scanner userInput = new Scanner(System.in);

    //Prompt use to enter a state

    String[][] stateData = 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"},

    };



    while(true) {

      System.out.println(                );

      System.out.println("Enter a State or None to exit:");

      String stateName = userInput.next();



      if(stateName.equalsIgnoreCase("None")) {

        System.exit(0);

import java.util.Scanner;

public class StatesDataEntry {
    /**
     *  the command line arguments
     */
    public static int getInfo(String statesDataEntry[][],String state)
   {
       int position = -1;
       boolean found = false;
       for (int index=0; index<statesDataEntry.length && !found; index++)
       {
           if(statesDataEntry[index][0].equalsIgnoreCase(state))
               position=index;             
       }
       return position;
   }



    public static void main(String[] args) {
        // TODO code application logic here
        Scanner userInput = new Scanner(System.in);
        //Prompt use to enter a state
        String[][] stateData = 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"},
        };

        while(true) {
            System.out.println(                                 );
            System.out.println("Enter a State or None to exit:");
            String stateName = userInput.next();

            if(stateName.equalsIgnoreCase("None")) {
                System.exit(0);
       
           
            }
            else {
                int position = getInfo(stateData, stateName);
                if(position != -1) {
                    System.out.println("Bird: " + stateData[position][1]);
                    System.out.println("Flower: " + stateData[position][2]);
                    System.out.println(                                 );                  
                }
                // End while loop
                else {
                    System.out.println("Invalid State Data Entered");
                   
                }               
            }           
        }
    }
}

      

      }

      else {

        int position = getInfo(stateData, stateName);

        if(position != -1) {

          System.out.println("Bird: " + stateData[position][1]);

          System.out.println("Flower: " + stateData[position][2]);

          System.out.println(                );         

        }

        // End while loop

        else {

          System.out.println("Invalid State Data Entered");

          

        }       

      }     

    }

  }

}

Answers

(5)
Status NEW Posted 13 Dec 2017 06:12 AM My Price 10.00

-----------  ----------- 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

Not Rated(0)