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
A 2-cm-diameter vertical water jet is injected upward by a nozzle at a speed of 15 m/s. Determine the maximum weight of a flat p
Ede4ka [16]

Answer:58.28 N

Explanation:

Given data

dia. of nozzle \left ( d\right )=2 cm

initial velocity\left ( u\right )=15 m/s

height\left ( h\right )=2m

Now velocity of jet at height of 2m

v^2-u^2=2gh

v^2=15^2-2\left ( 9.81\right )\left ( 2\right )

v=\sqrt{185.76}=13.62 m/s

Now\ forces\ on\ plate\ are\ weight\left ( Downward\right ) and jet\ force\left ( upward\right )

equating them

W=\left ( \rho Av\right )v

W=10^{3}\times \frac{\pi}{4}\left ( 0.02\right )^2\times 13.62^2

W=58.28 N

7 0
3 years ago
7.35 and 7.36 For the beam and loading shown, (a) draw the shear and bending-moment diagrams, (b) determine the maximum absolute
Crank

Maximum absolute values of the shear = 28 KN

Maximum absolute values of bending moment = 5.7 KN.m

<h3>How to draw Shear Force and Bending Moment Diagram?</h3>

A) We can see the beam loaded in the first image attached.

For the shear diagram, let us calculate the shear from point load to point load.

From A to C, summing vertical to zero gives; ∑fy = 0: -20 - V = 0

V = -20 KN

From C to D, summing vertical to zero gives; ∑fy = 0: -20 + 48 - V = 0

V = 28 KN

From D to E, summing vertical to zero gives; ∑fy = 0: -20 + 48 - 20 - V = 0

V = 8 KN

From E to B, summing vertical to zero gives; ∑fy = 0: -20 + 48 - 20 - 20 - V = 0

V = -12 KN

For the bending moment diagram, let us calculate the bending moment from point load to point load.

At point A, the bending moment would be zero. Thus, M_A = 0 KN.m

At point C, taking moment about point C and equating to zero gives;

M_C = 0. Thus; 20(0.225) + M = 0

M = -4.5 KN.m

At point D, taking moment about point D and equating to zero gives;

M_D = 0. Thus; 20(0.525) - 48(0.3) + M = 0

M = 3.9 KN.m

At point E, taking moment about point E and equating to zero gives;

M_D = 0. Thus; 20(0.75) - 48(0.525) + 20(0.225) + M = 0

M = 5.7 KN.m

At point B, taking moment about point E and equating to zero gives;

M_E = 0. Thus; 20(1.05) - 48(0.825) + 20(0.525) + (20 * 0.3) + M = 0

M = 2.1 KN.m

2) From the attached diagrams, we can deduce that;

Maximum absolute values of the shear = 28 KN

Maximum absolute values of bending moment = 5.7 KN.m

Read more about shear force & bending moment diagram at; brainly.com/question/14834487

#SPJ1

4 0
1 year ago
Match each titration term with its definition.
Illusion [34]

Answer:

1) titration

2) titrand

3) equivalence point

4) titrant

5) Burette

6) Indicator

Explanation:

The process in which a known volume of a standard solution is added to another solution so that the standard solution can react with the solution of unknown concentration such that its concentration is determined  can be referred to as titration.

The solution which is added to another solution  is called the titrant.  The titrand is the solution of unknown concentration

A burette is a glassware used to slowly add a known volume of the titrant to the titrand.

The indicator used signals the point when the reaction is complete by a color change. At this point, a stoichiometric amount of titrant has been added to the titrand. This is also referred to as the equivalence point.

3 0
3 years ago
A large building will need several different types of workmen to install and repair pipes for water, heating,
siniylev [52]

Answer:

Plumber and pipefitters

Explanation:

3 0
3 years ago
Whats viruses c liver?
PtichkaEL [24]

Answer:

Hepatitis C is a viral infection that causes liver inflammation, sometimes leading to serious liver damage. The hepatitis C virus (HCV) spreads through contaminated blood.

5 0
2 years ago
Read 2 more answers
Other questions:
  • A circuit-switching scenario in whichNcs users, each requiring a bandwidth of 25 Mbps, must share a link of capacity 150 Mbps.
    12·1 answer
  • Define initial set and final set. Briefly discuss one method used to determine them. The following laboratory tests are performe
    12·1 answer
  • In case of damaged prestressed concrete I girders which are used for restoring strength?
    9·1 answer
  • Discuss the impact of the changing urban center. Include the impacts on political, economic, and social roles and opportunities.
    12·1 answer
  • What did the ancient Greeks use simple machines for?
    15·2 answers
  • A torsion member has an elliptical cross section with major and minor dimensions of 50.0 mm and 30.0 mm, respectively. The yield
    10·1 answer
  • If you are in a tornado situation, which of the following actions would put you in danger?
    11·1 answer
  • 7. The binary addition 1 + 1 + 1 gives ​
    12·2 answers
  • It is ___ for motorcyclists to ride more than two abreast in a lane.
    7·1 answer
  • ) If the blood viscosity is 2.7x10-3 Pa.s, length of the blood vessel is 1 m, radius of the blood vessel is 1 mm, calculate the
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!