Question Details

(Solution document) Hello. I have found java code that I am trying to compile and get to run, however it is giving me the error "No main class found". I know I...


Hello. I have found java code that I am trying to compile and get to run, however it is giving me the error "No main class found". I know I need to include a main class, but I do not know where. Can anyone help?


I am copy/paste my code below:

package stateinfo;

import java.util.Scanner;


/**

 *File: StateInfo.java

 *Author: XXXXXXXXXXXX

 *Date: 25 Feb 2018

 *Purpose: Provide state flower and bird when user gives state 

 */




public class StateInfo{

   

  //Array of all state flowers and bird

  public String[][] states = {

      {"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 Slippper"},

      {"Mississippi", "Mockingbird", "Magnolia"},

      {"Missouri", "Bluebird", "Hawthorn"},

      {"Montana", "Western Meadowlark", "Bitterroot"},

      {"Nebraska", "Western Meadowlark", "Goldenrod"},

      {"Nevada", "Mountain Bluebird", "Sagebrush"},

      {"NewHampshire", "Purple Finch", "Purple Lilac"},

      {"NewJersey", "Eastern Goldfinch", "Violet"},

      {"NewMexico", "Roadrunner", "Yucca Flower"},

      {"NewYork", "Bluebird", "Rose"},

      {"NorthCarolina", "Cardinal", "Flowering Dogwood"},

      {"NorthDakota", "Western Meadowlark", "Wild Praire Rose"},

      {"Ohio", "Cardinal", "Scarlet Carnation"},

      {"Oklahoma","Scissor-tailed Flycatcher","Oklahoma Rose"},       

      {"Oregon", "Western Meadowlark", "Oregon Grape"},

      {"Pennsylvania", "Ruffed Grouse", "Mountain Laurel"},

      {"RhodeIsland", "Rhode Island Red", "Violet"},      

      {"SouthCarolina", "Great Carolina Wren", "Yellow Jessamine"},

      {"SouthDakota", "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"},

      {"WestVirginia", "Cardinal", "Rhododendron"},

      {"Wisconsin", "Robin", "Wood Violet"},

      {"Wyoming", "Western Meadowlark", "Indian Paintbrush"}

  }; //End states Array


  StringBuilder summary = new StringBuilder(); //new string builder for all information

   

 


   

  //Method to find the location of the state

  public int findState(String states[][], String state) {

    int position = -1;

    boolean found = false;

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

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

        position = index;

        

    }

    summary = summary.append(state).append(",");

    return position;

  }

   

  //Method to get get use user input and print the information

  public void useInfo(){

     while(true) {

        

      Scanner userIn = new Scanner(System.in);

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

      String state = userIn.nextLine();

      state = state.replaceAll("s","");

      state = state.substring(0, 1).toUpperCase() + state.substring(1);

       

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

        break;

      }

      else {

        int position = findState(states, state);

        if(position != -1) {

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

        summary.append(states[position][1]).append(",");

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

        summary.append(states[position][2]).append("n");

        } 

            

      }

    }

  }     

        

  //method to print the summary

  public void getSummary(){

    System.out.println("Thank you, nHere is a summary of the information gathered");

    System.out.println(summary);

  }      


}

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Dec 08, 2020

PRICE: $15

Solution~000652147569689.zip (25.37 KB)

Buy this answer for only: $15

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free solution (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Dec 08, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE.

Order Now