Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Just need the code to run this program in Java Now that we all live in the 305 arca code, we can use the letters

Just need the code to run this program in Java
image text in transcribed
Now that we all live in the 305 arca code, we can use the letters on a phone's keyboand to encode our phose numbers as strings, eg, my oftice umber 3052842158 can be encoded as the string "BoKAUHAV" (note the nero and cee-re left as 0 and l) It could also be c oded as RLAVICI KU , or-DUCUHB?LU", ot'ELCUG BIJU.. or '' there are lots of random egei ns. You must write a program to make a ?n om string code for a 305 phone number that is eniered as the last seven digits of the number Your program must: 1. Use a do-while loop to make sure the user enters a 7 digit number 2 Have a method that accepts an integer parameter (the number) and returns a String that is a random encoding of the number acconding to the normal phone keyboard . The method must use have two arrays. The first array contains the first letters for encoding each digit,ie.. , 'A, D, ...W.The second array contains the number of letters for each digit, ie 1.1,3,3,..4 . The method must we a while loop to extract each digit of the number ohne, use the modulus open or), encode the dpt randomly as of those comesponding to te digit as specised by te nnys hint. use Math.random and Math.floor), and build the encoded string Chint, use the concatenation operator). 3 Cl the encoding method twice, once to encode 305, and once to encode the seven digit mumber. 4. Print out the encoded number. Here what a sample run should look like (with the keyboard inpuat shown in italics) enter your 3 05 phose 284215 the phose aunber 303204215 cas be encoded a EuACHAISY

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+(2.9) PUAK =EP(A) - EP(ANA,) k=1 i

Answered: 1 week ago