answer.
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
Your roommate wants to learn about organizational chart. You can tell her that these charts can tell you all of these about an o
mars1129 [50]

Answer:

Control mechanisms

Explanation:

Organizational chart of any company will give details of different aspects of the company such as the major sub-units of the organization with the names of team leaders for different sub-units, it can also give you the span of control and the division of work within the company. However, the chart can't show you control mechanisms of different departments.

4 0
2 years ago
A 0.2-m^3 rigid tank equipped with a pressure regulator contains steam at 2MPa and 320C. The steam in the tank is now heated. Th
prohojiy [21]

Answer:

Q=486.49 KJ/kg

Explanation:

Given that

V= 0.2 m³

At initial condition

P= 2 MPa

T=320 °C

Final condition

P= 2 MPa

T=540°C

From steam table

At P= 2 MPa and T=320 °C

h₁=3070.15 KJ/kg

At P= 2 MPa and T=540°C

h₂=3556.64  KJ/kg

So the heat transfer ,Q=h₂ - h₁

Q= 3556.64 - 3070.15  KJ/kg

Q=486.49 KJ/kg

7 0
2 years ago
A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set
iVinArrow [24]

Answer:

Functions to create a median and mode of a set of numbers

Explanation:

def median(list):

   if len(list) == 0:

       return 0

   list.sort()

   midIndex = len(list) / 2

   if len(list) % 2 == 1:

       return list[midIndex]

   else:

       return (list[midIndex] + list[midIndex - 1]) / 2

def mean(list):

   if len(list) == 0:

       return 0

   list.sort()

   total = 0

   for number in list:

       total += number

   return total / len(list)

def mode(list):

   numberDictionary = {}

   for digit in list:

       number = numberDictionary.get(digit, None)

       if number == None:

           numberDictionary[digit] = 1

       else:

           numberDictionary[digit] = number + 1

   maxValue = max(numberDictionary.values())

   modeList = []

   for key in numberDictionary:

       if numberDictionary[key] == maxValue:

           modeList.append(key)

   return modeList

def main():

   print "Mean of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: ", mean(range(1, 11))

   print "Mode of [1, 1, 1, 1, 4, 4]:", mode([1, 1, 1, 1, 4, 4])

   print "Median of [1, 2, 3, 4]:", median([1, 2, 3, 4])

main()

3 0
2 years ago
Read 2 more answers
A shaft consisting of a steel tube of 50-mm outer diameter is to transmit 100 kW of power while rotating at a frequency of 34 Hz
nikitadnepr [17]

Answer:

25 - \sqrt[4]{26.66*10^{-8} }  mm

Explanation:

Given data

steel tube : outer diameter = 50-mm

power transmitted = 100 KW

frequency(f) = 34 Hz

shearing stress ≤ 60 MPa

Determine tube thickness

firstly we calculate the ; power, angular velocity and torque of the tube

power = T(torque) * w (angular velocity)

angular velocity ( w ) = 2\pif = 2 * \pi * 34 = 213.71

Torque (T) = power / angular velocity = 100000 / 213.71 = 467.92 N.m/s

next we calculate the inner diameter  using the relation

  \frac{J}{c_{2}  } = \frac{T}{t_{max} }  = 467.92 / (60 * 10^6) =  7.8 * 10^-6 m^3

also

c2 = (50/2) = 25 mm

\frac{J}{c_{2} } = \frac{\pi }{2c_{2} } ( c^{4} _{2} - c^{4} _{1} ) =  \frac{\pi }{0.050} [ ( 0.025^{4} - c^{4} _{1}  ) ]

therefore; 0.025^4 - c^{4} _{1} = 0.050 / \pi (7.8 *10^-6)

c^{4} _{1} = 39.06 * 10 ^-8 - ( 1.59*10^-2 * 7.8*10^-6)

    39.06 * 10^-8 - 12.402 * 10^-8 =26.66 *10^-8

c_{1} = \sqrt[4]{26.66 * 10^{-8} }  =

THE TUBE THICKNESS

c_{2} - c_{1} = 25 - \sqrt[4]{26.66*10^{-8} }  mm

4 0
2 years ago
A shipment of rebar that weighs 745 kg would weigh roughly how much in pounds​
Andre45 [30]

Answer:

Dont no but will check

Explanation:

6 0
2 years ago
Other questions:
  • A 12-L volume of oil is subjected to a pressure change, which produces a volume strain on the oil of -3.0 × 10-4. The bulk modu
    6·1 answer
  • Two AISI 304 stainless steel plates 10 mm thick are subjected to a contact pressure of 1 bar under vacuum conditions for which t
    9·1 answer
  • The following passage contains a fragment. Select the correct revision. Presley took the exuberance of gospel and added the freq
    7·1 answer
  • The mechanical properties of some metals may be improved by incorporating fine particles of their oxides. If the moduli of elast
    12·1 answer
  • An equation used to evaluate vacuum filtration is Q = ΔpA2 α(VRw + ARf) , Where Q ≐ L3/T is the filtrate volume flow rate, Δp ≐
    13·1 answer
  • A rectification column is fed 100 kg mol/h of a mixture of 50 mol % benzene and 50 mol % toluene at 101.32 kPa abs pressure. The
    5·1 answer
  • Toeboards are usually ___ inches high and used on landings and balconies.
    8·1 answer
  • Question 14<br> Which of these is true of a spray wash cabinet?
    6·1 answer
  • Who play 1v1 lol unblocked games 76
    8·2 answers
  • 1. A _____ is applied to a wall or roof rafters to add strength and keep the building straight and plumb.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!