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]
2 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]2 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 are some "vital signs" that we consider to tell us about the economy?
Wittaler [7]

Explanation:

if there is a deficit or a surplus

if the budget is good

7 0
3 years ago
Read 2 more answers
X+3=2<br>x=??<br><br><br><br>No spamming​
PtichkaEL [24]

Answer:

x+3=2

x=2-3꧁

꧁꧁꧂꧂꧂꧂

x=-1

4 0
3 years ago
The intake and exhaust processes are not considered in the p-V diagram of Otto cycle. a) true b) false
vovangra [49]

Answer:

b) false

Explanation:

We know that Otto cycle is the ideal cycle for all petrol working engine.In Otto cycle all process are consider is ideal ,means there is no any ir-reversibility in the processes.

It consist four processes

1-2:Reversible adiabatic compression

2-3:Constant volume heat addition

3-4:Reversible adiabatic expansion

3-4:Constant volume heat rejection

Along with above 4 processes intake and exhaust processes are parallel to each other.From the P-v diagram we can see that all processes.

But actually in general we are not showing intake and exhaust line then it did not mean that in Otto cycle did not have intake and exhaust processes.

6 0
3 years ago
A fluid of density 900 kg/m3 passes through a converging section of an upstream diameter of 50 mm and a downstream diameter of 2
NISA [10]

Answer:

Q= 4.6 × 10⁻³ m³/s

actual velocity will be equal to 8.39 m/s

Explanation:

density of fluid = 900 kg/m³

d₁ = 0.025 m

d₂ = 0.05 m

Δ P = -40 k N/m²

C v = 0.89

using energy equation

\dfrac{P_1}{\gamma}+\dfrac{v_1^2}{2g} = \dfrac{P_2}{\gamma}+\dfrac{v_2^2}{2g}\\\dfrac{P_1-P_2}{\gamma}=\dfrac{v_2^2-v_1^2}{2g}\\\dfrac{-40\times 10^3\times 2}{900}=v_2^2-v_1^2

under ideal condition v₁² = 0

v₂² = 88.88

v₂ = 9.43 m/s

hence discharge at downstream will be

Q = Av

Q = \dfrac{\pi}{4}d_1^2 \times v

Q = \dfrac{\pi}{4}0.025^2 \times 9.43

Q= 4.6 × 10⁻³ m³/s

we know that

C_v =\dfrac{actual\ velocity}{theoretical\ velocity }\\0.89 =\dfrac{actual\ velocity}{9.43}\\actual\ velocity = 8.39m/s

hence , actual velocity will be equal to 8.39 m/s

6 0
3 years ago
Science, Technology, Engineering &amp; Mathematics
miv72 [106K]

A communication systems

4 0
3 years ago
Other questions:
  • What is the maximum thermal efficiency possible for a power cycle operating between 600P'c and 110°C? a). 47% b). 56% c). 63% d)
    15·1 answer
  • Laws that protect businesses involve
    10·1 answer
  • Why Your first project as the new web designer at Smart Design is to increase web traffic to help boost web orders. Before you b
    6·1 answer
  • Structural engineers use wireless sensor networks to monitor the condition of dams and bridges.
    9·1 answer
  • Which type of engineer often works with radar, communication, and navigation systems? electrical engineer chemical engineer indu
    7·1 answer
  • In the construction of a large reactor pressure vessel, a new steel alloy with a plane strain fracture toughness of 55 MPa-m1/2
    7·1 answer
  • (I really need help ASAP please!! this is for science her is the problem)
    5·2 answers
  • DUE AT 3:00!!!!!
    13·2 answers
  • How the LED (light emitting diode) works?​
    8·2 answers
  • Problema sobre programacion orientada a objetos!!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!