Question Details

(Solution document) I am trying to add a function to my code to provide a summary of previous results when a user quits by entering "none" Code is as follows:...


I am trying to add a function to my code to provide a summary of previous results when a user quits by entering "none"


Code is as follows:


package statesymbols;


import java.util.Scanner;


public class StateSymbols {

public static void main(String[] args) {

// Okay so we have our state, bird, and, flower

String[][] states = {


{ "Texas", "Mockingbird", "Bluebonnet" },

{ "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 (Hawaiian Goose)", "Hibiscus" },

{ "Idaho", "Mountain Bluebird", "Syringa" },

{ "Illinois", "Cardinal", "Native violet" },

{ "Indiana", "Cardinal", "Peony" },

{ "Iowa", "Eastern Goldfinch", "Wild Rose" },

{ "Kansas", "Western Meadowlark", "Native Sunflower" },

{ "Kentucky", "Kentucky Cardinal", "Goldenrod" },

{ "Louisiana", "Pelican", "Magnolia" },

{ "Maine", "Chickadee", "White Pine Cone and Tassel" },

{ "Maryland", "Baltimore Oriole", "Black-Eyed Susan" },

{ "Massachusetts", "Chickadee", "Mayflower" },

{ "Michigan", "Robin", "Apple Blossom" },

{ "Minnisota", "Common Loon", "Pink and White Lady's Slipper" },

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

{ "Missouri", "Western Meadowlark", "Hawthorn" },

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

{ "Nebraska", "Western Meadowlark", "Goldenrodc" },

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

{ "New Hampshire", "Purple Finch", "Purple Lilac" },

{ "New Jersey", "Eastern Goldfinch", "Purple Violet" },

{ "New Mexico", "Roadrunner", "Yucca Flower" },

{ "New York", "Bluebird", "Rose" },

{ "North Carolina", "Cardinal", "Dogwood" },

{ "North Dakota", "Western Meadowlark", "Wild Prairie Rose" },

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

{ "Oklahoma", "Scissor-Tailed Flycatcher", "Mistletoe" },

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

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

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

{ "South Carolina", "Carolina Wren", "Yellow Jessamine" },

{ "South Dakota", "Ring-Necked Pheasant",

"American Pasqueflower" },

{ "Tennessee", "Mockingbird", "Iris" },

{ "Utah", "California Gull", "Sego Lily" },

{ "Vermont", "Hermit Thrush", "Red Clover" },

{ "Virgina", "Cardinal", "Dogwood" },

{ "Washington", "Willow Goldfinch", "Western Rhododendron" },

{ "West Virginia", "Cardinal", "Big Rhododendron" },

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

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

{ "Washington D.C", "Woodthrush", "American Beauty Rose" }


};

// Input

@SuppressWarnings("resource")

Scanner input = new Scanner(System.in);


boolean doQuit = false;

// While not quitting, run the program

while(!doQuit) {

// Ask for a state

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

String inputStateName = input.nextLine();

// If the input is 'quit', then stop this loop

if(inputStateName.equalsIgnoreCase("none")) {

doQuit = true;

} else {

// If input is not quit, run the program

for(int i = 0; i < states.length; i++) {

String stateName = states[i][0];

String stateBird = states[i][1];

String stateFlower = states[i][2];


if(stateName.equalsIgnoreCase(inputStateName)) {

System.out.println("Bird: " + stateBird);

System.out.println("Flower: " + stateFlower);

}

}

}

}


}


}

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Dec 08, 2020

PRICE: $15

Solution~000652147570059.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