1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
KatRina [158]
3 years ago
12

Write a simple phonebook program that reads in a series of name-number pairs from the user (that is, name and number on one line

separated by whitespace) and stores them in a Map from Strings to Integers. Then ask the user for a name and return the matching number, or tell the user that the name wasn’t found.
Engineering
1 answer:
Vlad1618 [11]3 years ago
6 0

Answer:

import java.util.HashMap;

import java.util.Map;

import java.util.Scanner;

public class PhoneBook {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       Map<String, String> map = new HashMap<>();

       String name, number, choice;

       do {

           System.out.print("Enter name: ");

           name = in.next();

           System.out.print("Enter number: ");

           number = in.next();

           map.put(name, number);

           System.out.print("Do you want to try again(y or n): ");

           choice = in.next();

       } while (!choice.equalsIgnoreCase("n"));

       System.out.print("Enter name to search for: ");

       name = in.next();

       if (map.containsKey(name)) {

           System.out.println(map.get(name));

       } else {

           System.out.println(name + " is not in the phone book");

       }

   }

}

You might be interested in
Food, animals, wood and alcohol are examples of:
Fantom [35]
I pretty sure it would be A
4 0
3 years ago
Read 2 more answers
What is the air change rate (ACH) for a 100 ft^2 (9.3 m^2) space with a 10 ft (3.0 m) ceiling and an airflow rate of 200 cfm (95
kakasveta [241]

Answer:

The ACH is 12/h

Solution:

As per the question:

Area of the space, A_{s} = 100 ft^{2}

Height of the given space, h = 10 ft

Air flow rate, Q_{a} = 200 cfm

Now, to find the Air Change Rate (ACH):

We calculate the Volume of the given space:

V_{s} = A_{s}\times h = 100\times 10 = 1000 ft^{3}

Now, the ACH per min:

= \frac{V_{s}}{Q_{a}} = \frac{1000}{200} = 5/min

Now, ACH per hour:

= \frac{60}{5} = 12/h

3 0
4 years ago
The activation energy for diffusion in BCC iron is 84 kJ/mol. Which of the following explains why the carbide precipitation acti
k0ka [10]

Answer:

  • B. Precipitation require the diffusional activation energy plus an additional energy to form the precipitate.

Explanation:

Precipitation is the creation of a solid from a solution. When the reaction occurs in a liquid solution, the solid formed is called the precipitate.

The formation of a precipitate indicates the occurrence of a chemical reaction.

Precipitation of carbide requires alot of energy which the diffusion activational energy alone cannot achieve and this was calculated to be 225.6 kJ/mol.

3 0
4 years ago
A milling operation was used to remove a portion of a solid bar of square cross section. Forces of magnitude P = 19 kN are appli
lakkis [162]

Answer:

Complete question for your reference is below.

A milling operation was used to remove a portion of a solid bar of square cross section. Forces of magnitude P = 19 kN are applied at the centers of the ends of the bar. Knowing that a = 28 mm and sigma_all = 130 MPa, determine the smallest allowable depth d of the milled portion of the bar

Explanation:

Please find attached file for complete answer solution and explanation.

3 0
4 years ago
a(n) cycle is the complete operating sequence of a water closet, urinal, or similar device or fixture.
Lady bird [3.3K]

According to plumbing regulations, every home must have a minimum of one toilet, one bathroom sink, one bathtub or shower, and one kitchen sink. Fixtures include items like these and a few more things mentioned in this chapter.

When choosing fixtures, consider flow rates, volume, and water usage. Water saving is a major concern of plumbing sustainability. Two key areas for water conservation are shower heads and bathroom faucets. The length of each use determines how much water is actually saved when taking a shower. A handheld shower may have controls that allow the water flow to be turned off while performing specific showering tasks, including lathering.

Learn more about fixtures here:

brainly.com/question/28430942

#SPJ4

5 0
1 year ago
Other questions:
  • Explain what entropy is in relation to the second law of thermodynamics?
    9·1 answer
  • Using the tables for water determine the specified property data at the indicated state. For H2O at T = 140 °C and v = 0.2 m3/kg
    7·2 answers
  • It is possible to maintain a pressure of 10 kPa in a condenser that is being cooled by river water entering at 20 °C?
    13·1 answer
  • If we have silicon at 300K with 10 microns of p-type doping of 4.48*10^18/cc and 10 microns of n-type doping at 1000 times less
    7·1 answer
  • What is the dimensionless heat conduction rate for a sphere at surface temperature T1 buried in an infinite medium of temperatur
    15·1 answer
  • A defective crankshaft position sensor is a common cause of a no-start condition.
    7·1 answer
  • Freeeee pointssssssssssss
    8·2 answers
  • Which of the following is a measurement at the nominal level?
    8·1 answer
  • What is vapier calliper​
    15·1 answer
  • What are the reasons why fine grained of alkali igneous rocks can not be used in cement
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!