String key - a String "key phrase" that contains letters, which will be used in decoding String code - a String containing a series of integers which represent the indexes in key Methods A two-parameter constructor to initialize key and code A method public String decode () that will return a "decoded" message. The message has been encoded in the following manner: each integer in code is an index pointing to a location in key. To decode the message, simply look up each integer in key and output the corresponding character. To test your method, create a new SecretCode object in the Runner class with the following inputs: String key "six perfect quality black jewels amazed the governor" String code = "35 10 10 33 9 24 3 17 41 8 3 20 51 16 38 44 47 32 33 10 19 38 35 28 49" = If your method is written correctly, it should return a covert message. You must use a Scanner object to parse the String (rather than split () and Integer.parseInt())! Scanner objects will help on this and future labs.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

How would you create the scanner object to parse the String for the Strings key and code? This is in java and is non graded lab (practice). 

<
9:54
Methods
String key - a String "key phrase" that
contains letters, which will be used in
decoding
String code - a String containing a series
of integers which represent the indexes in
key
8+
A two-parameter constructor to initialize
key and code
A method public String decode ()
that will return a "decoded" message. The
message has been encoded in the following
manner: each integer in code is an index
pointing to a location in key. To decode
the message, simply look up each integer in
key and output the corresponding
character.
To test your method, create a new SecretCode
object in the Runner class with the following
inputs:
19
=
=
String key "six perfect quality black
jewels amazed the governor"
String code "35 10 10 33 9 24 3 17 41
8 3 20 51 16 38 44 47 32 33 10 19 38 35
28 49"
If your method is written correctly, it should return
a covert message. You must use a Scanner object
to parse the String (rather than split () and
Integer.parseInt ())! Scanner objects will
help on this and future labs.
<>
Transcribed Image Text:< 9:54 Methods String key - a String "key phrase" that contains letters, which will be used in decoding String code - a String containing a series of integers which represent the indexes in key 8+ A two-parameter constructor to initialize key and code A method public String decode () that will return a "decoded" message. The message has been encoded in the following manner: each integer in code is an index pointing to a location in key. To decode the message, simply look up each integer in key and output the corresponding character. To test your method, create a new SecretCode object in the Runner class with the following inputs: 19 = = String key "six perfect quality black jewels amazed the governor" String code "35 10 10 33 9 24 3 17 41 8 3 20 51 16 38 44 47 32 33 10 19 38 35 28 49" If your method is written correctly, it should return a covert message. You must use a Scanner object to parse the String (rather than split () and Integer.parseInt ())! Scanner objects will help on this and future labs. <>
Expert Solution
Step 1: Step 1

Create a Java class called SecretCode with the required constructor and decode method to complete this task.

steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

is there a way to do this code without using chars?

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education