I have a Java Code here. I am in need of getting this code to generate
I have a Java Code here. I am in need of getting this code to generate
a summary after it prints out the information that is input. I have it where I can enter a state name and it will give me and output of the bird and flower for the state. When entering a state name I need it to be able to be entered lower case upper case a space behind it or an uppercase throughout the word. For example; Ohio, ohio, OHIO , ohIo. The last thing I am having problems with is creating a summary for the data that I requested.
The summary data should look like this from whatever states I enter:
**** 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 StateBirda {
/** Holds every state to include bird and flower for each state.*/
private static String state[][]={
{“Alabama”,”Yellowhammer”,”Camellia”},
{“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”,”Columbine”},
{“Connecticut”,”American Robin”,”Mountain Laurel”},
{“Delaware”,”Blue Hen Chicken”,”Peach Blossom”},
{“Florida”,”Mockingbird”,”Orange Blossom”},
{“Georgia”,”Brown Thrasher”,”Cherokee Rose”},
{“Hawaii”,”Nene”,”Pua Aloalo”},
{“Idaho”,”Mountain Blue Bird”,”Syringa- Mock Orange”},
{“Illinois”,”Cardinal”,”Purple Violet”},
{“Indiana”,”Cardinal”,”Peony”},
{“Iowa”,”Eastern Goldfinch”,”Wild Praire Rose”},
{“Kansas”,”Western Meadowlark”,”Sunflower”},
{“Kentucky”,”Cardinal”,”Goldenrod”},
{“Louisiana”,”Eastern Brown Pelican”, “Magnolia”},
{“Maine”,”Chickadee”,”White Pine Cone and Tassel”},
{“Maryland”,”Baltimore Oriole”,”Black-eyed Susan”},
{“Massachusettes”,”Chickadee”,”Trailing Arbutus”},
{“Michigan”,”American 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”,”Road Runner”,”Yucca Flower”},
{“New York”,”Bluebird”,”Rose”},
{“North Carolina”,”Cardinal”,”American Dogwood”},
{“North Dakota”,”Western Meadowlark”,”Wild Prairie Rose”},
{“Ohio”,”Cardinal”,”Scarlet Carnation”},
{“Oklahoma”,”Sciccor-tailed Flycatcher”,”Mistletoe”},
{“Oregon”,”Western Meadowlark”,”Oregon Grape”},
{“Pennsylvnia”,”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”,”Iris”},
{“Texas”,”Mockingbird”,”Bluebonnet”},
{“Utah”,”Common American Gull”,”Sego lily”},
{“Vermont”,”Hermit Thrush”,”Red Clover”},
{“Virginia”,”Cardinal”,”American Dogwood”},
{“Washington”,”Willow Goldfinch”,”Coast Rhododendron”},
{“West Virginia”,”Cardinal”,”Rhododendron”},
{“Wisconsin”,”Robin”,”Wood Violet”},
{“Wyoming”,”Western Meadowlark”,”Indian Paintbrush”},
};
public static void main(String args[]){
Scanner scanner=new Scanner(System.in);
while(true){
System.out.println(“Enter a State or None to exit:”);
String stateName =scanner.nextLine();
if(stateName.equals(“None”)){
break;
}
//Search the state name into list
stateName =stateName.toLowerCase();
for(int i=0;i<state.length;i++){
if(stateName.equals(state[i][0].toLowerCase())){
System.out.println(“”+state[i][0]);
System.out.println(“The State Bird: “+state[i][1]);
System.out.println(“The State Flower: “+state[i][2]);
}
}
}
My current output when I enter Ohio is:
Enter a State or None to Exit:
Ohio
The State Bird: Cardinal:
The State Flower: Scarlet Carnation
Enter a State or None to Exit:
Any help would be greatly appreciated being able to enter multiple states in that have upper and lowercases in the state name and a summary.