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
What is A roofed structure that is similar to a porch, but is detached from the house.
agasfer [191]

Answer:

a gazebo

Explanation:

6 0
4 years ago
Read 2 more answers
How does the two-stroke Otto cycle differ from the four-stroke Otto cycle?
Digiron [165]

Answer:

Two stroke cycle                                               Four stroke cycle

1.Have on power stroke in one revolution.   1.have one power  

                                                                   stroke in two  revolution                                                                            

2.Complete the cycle in 2 stroke                 2.Complete the cycle in 4 stroke    

3.It have ports                                                3.It have vales

                                                                         

4.Greater requirement of cooling              4.Lesser requirement of cooling  

5.Less thermal efficiency                            5.High thermal efficiency

6.Less volumetric efficiency                       6.High volumetric efficiency    

7.Size of flywheel is less.                           7.Size of flywheel is more.

3 0
3 years ago
a buyer can purchase 70 screwdrivers ten 4-inch length twelve 6 inch length twenty 8-inch length are needed. how many heavy 24-i
jasenka [17]

Answer:

28 , 24-inch screwdrivers

Explanation:

The total number of screwdrivers that can be purchased is = 70

4 - inch length screwdrivers = 10

6- inch length screwdrivers = 12

8- inch length screwdrivers = 20

Total = 20 +12 +10 = 42

Remaining = 70-42 = 28

So, heavy 24-inch screwdrivers = 28

3 0
3 years ago
A 1020 CD steel shaft is to transmit 15 kW while rotating at 1750 rpm. Determine the minimum diameter for the shaft to provide a
vladimir2022 [97]

Answer:

diameter is 14 mm

Explanation:

given data

power = 15 kW

rotation N = 1750 rpm

factor of safety = 3

to find out

minimum diameter

solution

we will apply here power formula to find T that is

power = 2π×N×T / 60    .................1

put here value

15 ×10^{3} = 2π×1750×T / 60

so

T = 81.84 Nm

and

torsion = T / Z                        ..........2

here Z is section modulus i.e = πd³/ 16

so from equation 2

torsion = 81.84 / πd³/ 16

so torsion = 416.75 / / d³     .................3

so from shear stress theory

torsion = σy / factor of safety

so here σy = 530 for 1020 steel

so

torsion = σy / factor of safety

416.75 / d³ = 530 × 10^{6} / 3

so d = 0.0133 m

so diameter is 14 mm

3 0
4 years ago
Which tool ensures that a fastener has the proper amount of tightness
Sidana [21]

A torque wrench tool is a tool that ensures that a fastener has the proper amount of tightness.

<h3>What is the torque wrench used for?</h3>

The torque wrench tool is used to ensure screws and bolts are properly tightened. When performing home repairs and maintenance of equipment it is quite important that a torque wrench is used in other to prevent a scenario where a fastener (screws and bolts) does not become loose leading to equipment failure or damage. Because of its many advantages, this tool is often found in the possession of construction workers.

You can learn more about the benefits of a torque wrench tool here

brainly.com/question/15075481

#SPJ1

7 0
2 years ago
Other questions:
  • A fluid flows steadily through a pipe with a uniform cross sectional area. The density of the fluid decreases to half its initia
    6·1 answer
  • A furnace wall consisting of 0.25 m of fire clay brick, 0.20 m of kaolin, and a 0.10‐m outer layer of masonry brick is exposed t
    8·1 answer
  • The following liquids are stored in a storage vessel at 1 atm and 25°C. The vessels are vented with air. Determine whether the e
    5·1 answer
  • What is measurement in term of electrical engineering ​
    5·1 answer
  • Give an example of one technology that is well matched to the needs of the environment, and one technology that is not.
    9·1 answer
  • An electrochemical cell is composed of pure nickel and pure iron electrodes immersed in solutions of their divalent ions. If the
    13·1 answer
  • the AADT for a section of suburban freeway is 150000 veh/day. Assuming this is an urban radial facility, what range of direction
    7·1 answer
  • Describe the algorithm you use for looking up a person’s telephone number in the phone book. The input is person’s name; the out
    9·2 answers
  • Joey has a car that uses the hand crank to open the windows. Joey is wondering where the energy comes from to open the windows.T
    11·1 answer
  • During welding in the vertical position, the torch angle can be varied to control sagging.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!