Writejava class take a seven-letter return the phone numbers

Assignment Help Basic Computer Science
Reference no: EM13230629

this week you are required to use concepts learned in this week: strings and the Java library method contains. Write a Java class PhoneNumber that will take in a seven-letter word and return the phone number that corresponds to it. In the United States, the digits on a phone pad are mapped to letters by the following table: digit letter 1 2 A B C 3 D E F 4 G H I 5 J K L 6M N O 7 P Q R S 8 T U V 9 W X Y Z 0 Hence a 7 digit phone number like HAIRCUT would map to 424-7288; NEWCARS would map to 639-2277. Submit a Java program PhoneNumber.java which has just one method decode and behaves as below PhoneNumber pn = new PhoneNumber(); pn.decode( "HAIRCUT") => "4247288" pn.decode("NEWCARS") => "6392277" Implementation Requirement: If s is a variable of type String, that holds the phone number to be decoded (e.g. "HAIRCUT") then you should structure your program around a nested if-else statement and use the contains method of the String class to check for the condition below: if ("ABC".contains(""+s.charAt(i))) { ...; } else if ("DEF".contains(""+s.charAt(i))) { ...; ... }

Reference no: EM13230629

Questions Cloud

What is the manufacturers price : What is the retailer's markup in dollars and what is the wholesale price, what is the manufacturer's price?
Audit committees and fraud risk management : Audit committees and fraud risk management.
Determine the percentage speed regulation : A 120 V separately excited DC Motor is operated at a fixed field current. It has an armature resistance Ra = 10 ohms, and a machine constant K = 0.1 V/rpm. The armature current is 0.5 amps with no load, and 3.0 amps at full load.
Evaluate potential transportation providers : A Chicago-based manufacturer is looking for someone to handle its shipments to the West Coast. In order to evaluate potential transportation providers
Writejava class take a seven-letter return the phone numbers : this week you are required to use concepts learned in this week: strings and the Java library method contains. Write a Java class PhoneNumber that will take in a seven-letter word and return the phone number that corresponds to it.
Choose one of the potential business owners listed : A middle-management corporate refugee desiring a business of her own after frustration with bureaucratic red tape.
What weight of sodium formate : What weight of sodium formate must be added to 400mL of 1M formic acid to produce a buffer solution that has a pH of 3.50
Explain the mole fraction of oxygen in the atmosphere : The mole fraction of oxygen in the atmosphere is .21. If the barometric pressure is 0.975 atm, what is the concentration of oxygen in water? Kh=1.3 x10^-3 M/atm
Explain frozen temperature : What occurs with the plasma membrane so that frozen temperatures hurts a cell? I know crystals form and the cell bursts but WHAT actually occurs so that this happens

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Choose one schedule development tools

In this discussion, choose one of the schedule development tools introduced or another tool that you are already familiar with that was not identified in the studies. Identify the tool and complete the following.

  Which shipper service to choose for company

Your task is to choose the best shipper for company. Compare these shippers, like FedEx (www.fedex.com), UPS (www.ups.com), and the U.S. Postal Service (www.usps.gov).

  Write subroutine in marie assembly that multiplies two value

Write a subtoutine in MARIE assembly that multiplies two values where the arguments for this subroutine are two pointers (each pointer pointing to a value). The routube, multiply (a,b), performs *a x *b where a's value is the address storing the valu..

  Find out winner in card game

When there is tie, nobody loses. If first two cards total 8 or 9, hand is called a "natural" and it wins automatically, unless both hands have equal value "naturals", in which case it's a tie.

  Identify and describe any potential ethical issues

Identify and describe any potential ethical issues that could arise in connection with the new architecture.

  Explain dispatcher and data access object design

Prepare a two page paper comparing and contrasting five of design. Dispatcher - controls client access and re-directs or dispatches client requests to proper party which can be located on same or different tier.

  Show the risk mitigation strategy

Each member selects one of the highest risks. Explain why these are considered high risk, and explain their potential effect on the project and outline a risk mitigation strategy for the each of the selected high risks.

  Performance of receiver-initiated load sharing algorithm

Predict the performance of receiver-initiated load sharing algorithm when entire system workload is generated at only a few nodes in the system instead of equally.

  Write a method that returns index of the smallest element

Write a method that returns the index of the smallest element in an array of integers

  The load master for a freighter

The load master for a freighter wants to determine the mix of cargo to be carried on the next trip. The ship's volume limit for cargo is 100,000 cubic meters, and it weight capacity is 2,310 tons.

  Explain how fuzz based systems work

Explain how fuzz based systems work and provide a detailed example of a system that utilises fuzzy logic.

  What is effect of control hazards on cpi for pipeline

What is the effect of control hazards on the CPI for this pipeline? Consider the two cases of "predict branch not taken" and "predict branch taken".

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd