Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
Question
Book Icon
Chapter 21, Problem 21.9PE
Program Plan Intro

StateCapital.Java

Program Plan:

  • Include the class name named “StateCapital_Map”.
    • Declare the package.
    • Import the util package.
    • Define class.
    • Declare the main()method.
    • Create a Scanner.
    • Store 50 states and their capitals in a map.
    • Prompt the user to enter a state.
    • Check if state is present.
    • Close the main method.
    • Create another Method getData that stores the 50 states and their capitals in a map.
    • Define a new hashmap.
    • Declare a map data.
      • assign states along with their capitals
    • Create a loop to traverse through the entire data length.
      • Put each state with their capital in the data.
    • Return the map.
    • Print the user entered state along with their capital from the map.
    • Close the class.

Blurred answer
Students have asked these similar questions
:Write some statements that display a list of integers from 10 to 20 inclusive ,each with its square root next to it. Write a single statement to find and display the sum of the successive even integers 2, 4, ..., 200. (Answer: 10 100) Ten students in a class write a test. The marks are out of 10. All the marks are entered in a MATLAB vector marks. Write a statement to find and display the average mark. Try it on the following marks: 580 10 3 85794 (Answer: 5.9)
def winning_card(cards, trump=None): Playing cards are again represented as tuples of (rank,suit) as in the cardproblems.pylecture example program. In trick taking games such as whist or bridge, four players each play one card from their hand to the trick, committing to their play in clockwise order starting from the player who plays first into the trick. The winner of the trick is determined by the following rules:1. If one or more cards of the trump suit have been played to the trick, the trick is won by the highest ranking trump card, regardless of the other cards played.2. If no trump cards have been played to the trick, the trick is won by the highest card of the suit of the first card played to the trick. Cards of any other suits, regardless of their rank, are powerless to win that trick.3. Ace is the highest card in each suit.Note that the order in which the cards are played to the trick greatly affects the outcome of that trick, since the first card played in the trick…
C Programming Language (Code With C Programming Language) Problem Title : Visible Trees There is a legend about a magical park with N × N trees. The trees are positioned in a square grid with N rows (numbered from 1 to N from north to south) and N columns (numbered from 1 to N from west to east). The height (in metres) of each tree is an integer between 1 and N × N, inclusive. Magically, the height of all trees is unique. Bunga is standing on the northmost point of the park and wants to count the number of visible trees for each Column. Similarly, Lestari is standing on the westmost point of the park and wants to count the number of visible trees for each Row. A tree X is visible if all other trees in front of the tree X are shorter than the tree X. For example, let N = 3 and the height (in metres) of the trees are as follows6 1 87 5 32 9 4 On the first column, Bunga can see two trees, as the tree on the third row is obstructed by the other trees. On the second column, Bunga can see…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education