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
The water of a 14’ × 48’ metal frame pool can drain from the pool through an opening at the side of the pool. The opening is abo
Tresset [83]

Answer:

Explanation:

Height h = 1.03m

Volume v = 3780 gallons = 3780 * 0.0037851m^3 = 14.3073m^3

Time t = 13.5 mins = 13.5 * 60 = 810 seconds

Length of pool L = 14 inch = 14 * 2.54 = 35.56cm

width of pool b = 48 inch = 48 * 2.54 = 121.92 cm

a.) Consider the bernoulli's equation is given as:

P_1+\rho gh_1 + \frac{1}{2}\rho v_1^2 = P_2 + \rho gh_2 + \frac{1}{2}\rho v_2^2 ...(1)

consider the equation of bernoulli at the top of the pool

P_0+\rho gh_1 + \frac{1}{2}\rho v_1^2 =constant ...(2)

where P_1=P_0 atm pressure

At the top of the pool v_1=0m/s, substitute in V_1 in equation (2)

P_0+\rho gh_1 =constant ...(3)

Hence equation (3) serves as the bernoullis equation at the top.

b.) Consider the equation of bernoulli's at the opening of the pool

P_2+\rho gh_2 + \frac{1}{2}\rho v_2^2 =constant ...(4)\\P_0+\rho gh_2 + \frac{1}{2}\rho v_2^2 =constant ...(5)

where P_2=P_0 atm pressure and h_2=0m

P_0+\rho v_1^2 =constant ...(6)

Hence equation (6) serves as the bernoullis equation of water at the opening of the pool.

c.) Consider the equation (3) and (4)

        P_0+\rho gh_1 =P_0+\rho v_1^2\\\\\frac{1}{2}\rho v_2^2=\rho gh_1\\v_2^2=2gh_1\\v_2=(\sqrt{2gh_1})m/s...(7)    

Hence velocity is v_2=(\sqrt{2gh_1})m/s

d.) consider (7)

v_2=(\sqrt{2(9.81)(1.03)})=4.4954m/s(approx)

This is the norminal value of velocity  

e.) consider the equation of flow rate interval of v and t

flow(t)=\frac{dv}{dt}(m^3/s) hence this is the flow rate

f.) Consider the equation cross sectional area in terms of V,v2 and t

AV_2=\frac{v}{t}\\\\A=\frac{v}{v_2t}(m^2)...8

hence this serves as the cross sectional area.

g.) Consider the equation of area from equation (8)

A=\frac{v}{v_2t}\\=\frac{14.3073}{4.4954\times 810}=0.003929=0.00393m^2=39.3cm^2

6 0
2 years ago
what is an example of an innovative solution to an engineering problem? Explain briefly why you chose this answer.
Leviafan [203]

Answer:

robotic technology    

Explanation:

Innovation is nothing but the use of various things such as ideas, products, people to build up a solution for the benefit of the human. It can be any product or any solution which is new and can solve people's problems.

Innovation solution makes use of technology to provide and dispatch new solutions or services which is a combination of both technology and ideas.

One such example of an innovative solution we can see is the use of "Robots" in medical science or in any military operations or rescue operation.

Sometimes it is difficult for humans to do everything or go to everywhere. Thus scientist and engineers have developed many advance robots or machines using new ideas and technology to find solutions to these problems.

Using innovations and technologies, one can find solutions to many problems which is difficult for the peoples. Robots can be used in any surveillance operation or in places of radioactive surrounding where there is a danger of humans to get exposed to such threats. They are also used in medical sciences to operate and support the patient.  

3 0
3 years ago
1. Which of the following will cause a spark knock?
zlopas [31]

Answer:

I couldn't find options for your question online, but I can give you an explanation so you can choose the correct option.

Explanation:

A spark knock is a form of unpredictable behavior that occurs in combustion, that is, in the chemical reaction that occurs between oxygen and an oxidizable material. Such combustion is usually manifested by incandescence or flame.

The spark knock is a detonation that occurs when there is a lot of pressure in the fuel.

<u>Some situations in which this can happen are: </u>

  • Engine overloaded.
  • Maximum pressure in the cylinders.
  • Engine overheated.
  • Overheated air.
  • Long and excessive engine ignition timing.
  • Spark plug at high temperatures.
5 0
3 years ago
Design a half-wave recti er which provides a peak voltage of 15 V, and anaverage voltage of 3.8 V when driven by a 120 V (rms) a
nirvana33 [79]

Answer:

You need a 120V to 24V commercial transformer  (transformer 1:5), a 100 ohms resistance, a 1.5 K ohms resistance and a diode with a minimum forward current of 20 mA (could be 1N4148)

Step by step design:

  1. Because you have a 120V AC voltage supply you need an efficient way to reduce that voltage as much as possible before passing to the rectifier, for that I recommend a standard 120V to 24V transformer.  120 Vrms = 85 V and 24 Vrms = 17V = Vin
  2. Because 17V is not 15V you still need a voltage divider to step down that voltage, for that we use R1 = 100Ω and R2 = 1.3KΩ. You need to remember that more than 1 V is going to be in the diode, so for our calculation we need to consider it. Vf = (V*R2)/(R1+R2), V = Vin - 1 = 17-1 = 16V and Vf = 15, Choosing a fix resistance R1 = 100Ω and solving the equation we find R2 = 1.5KΩ
  3. Finally to select the diode you need to calculate two times the maximum current and that would be the forward current (If) of your diode. Imax = Vf/R2 = 10mA and If = 2*Imax = 20mA

Our circuit meet the average voltage (Va) specification:

Va = (15)/(pi) = 4.77V considering the diode voltage or 3.77V without considering it

6 0
3 years ago
A semiconductor is a solid substance that has a conductivity between that of an insulator and that of most metals. (True , False
tiny-mole [99]

The answer is : True

4 0
2 years ago
Other questions:
  • The spring has a stiffness k=200 N/m and is unstretched when the 25 kg block is at A. Determine the acceleration of the block wh
    6·1 answer
  • Chapter 15 – Fasteners: Determine the tensile load capacity of a 5/16 – 18 UNC thread and a 5/16 – 24 UNF thread made of the sam
    8·2 answers
  • Write a complete C++ program that is made of functions main() and rShift(). The rShift() function must be a function without ret
    7·1 answer
  • "The office personnel at Garden Glory use a database application to record services and related data changes in this database. F
    9·1 answer
  • A 3-phase, 50 Hz, 110 KV overhead line has conductors placed in a horizontal plane 3 m apart. Conductor diameter is 2.5 cm. If t
    6·1 answer
  • The annual storage in Broad River watershed is 0 cm/y. Annual precipitation is 100 cm/y and evapotranspiration is 50 cm/y. The s
    10·2 answers
  • 10. To cut 1/4" (6 mm) thick mild steel at a rate of 40 inches per minute, the current would be set to
    7·1 answer
  • What’s the population in the world and why does it keep increasing in bad areas.
    8·1 answer
  • How to Cancel prescription
    12·1 answer
  • Which type of engineer is needed in the following scenario?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!