Create an interface MessageDecoder that has a single abstract method decode (cipherText), where cipherText is the message to be decoded. The method will return the decoded message. Modify the classes SubstitutionCipher and ShuffleCipher, as described in Exercises 16 and 17, so that they implement MessageDecoder as well as the interlace MessageEncoder that Exercise 15 describes. Finally, write a program that allows a user to encode and decode messages entered on the keyboard.
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Java: Introduction to Problem Solving and Programming
Additional Engineering Textbook Solutions
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
Starting Out with C++: Early Objects
Modern Database Management
Starting Out with Java: Early Objects (6th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Python (3rd Edition)
- We have a parking office class for an object-oriented parking management system using java Add(implement) a method to the Parking Office class to return the collection of permit ids for a specific customer (getPermitIds(Customer)) using java I have attached two class diagrams with definitions of all related classes in our system (i.e car, customer, .....). N.B. Parking office methods in the class definition like register, getcustomer and addcharge have already been implemented, we just need an additional getPermitIds(Customer) method as mentioned above Explain your code in a few words Important- We have a method to return a collection of permit ids (getPermitIds), what we need is a method to return the collection of permit ids for a specific customer (getPermitIds(Customer))arrow_forwardWrite a Java program with at least two classes. Use a circle object to represent it. The class must offer at least one (non-static) setter method and one (non-static) getter method. Implement at least one test that invokes the setter method and the corresponding getter method so that the value out == the value in. Also use assert.Equal(60, circle1.getCircumference(), 10); and assert.Equals(10, circle1.get Radius(), 0.1); for radiusarrow_forwardModify the GeometricObject class to implement the Comparable interface and define a static max method in the GeometricObject class for finding the larger of two GeometricObject objects. Draw the UML diagram and implement the new GeometricObject class. Write a test program that uses the max method to find the larger of two circles, the larger of two rectangles.using java programmingarrow_forward
- Imagine you have two classes: Employee (which represents being an employee) and Ninja (which represents being a Ninja). An Employee has both state and behaviour; a Ninja has only behaviour. You need to represent an employee who is also a ninja (a common problem in the real world). By creating only one interface and only one class (NinjaEmployee), show how you can do this without having to copy method implementation code from either of the original classes.arrow_forwardMake a Visible interface with the two methods makeVisible and makeInvisible. Both procedures must return a boolean value with no arguments. How would a class implement this interface?arrow_forwardwrite program in java Design an abstract class GeometricObject. GeometricObject must ensure that its children must implement calcArea() method. Design RectangleYourRegNo and CircleYourName Classes as children of GeometricObject class with overridden toString() method to return “Rectangle with w Width and h Height is drawn” OR “Circle with r Radius is drawn”. The attributes of Rectangle are length, width. The attribute of Circle is radius Hint: Area of circle=πr2 , Area of rectangle= width*lengtharrow_forward
- Given the main class Dog, subclass Poodle, and the beginning of the subclass Pug:Instructions for Pug.java Variables: int flabCount – the count of layers on the Pug An invalid value should default this field to 25. A value is invalid if it is nonpositive. boolean isPound – whether this Pug resides in the pound. Poodle bestFriend- a Poodle who is the best friend with the Pug Constructors: A constructor that takes in name, length, weight, stripeCount, isSaltwater, and bestFriend. The bestFriend argument should be deep copied. A constructor that takes in no parameters and sets name to “Pluto”, length to 30.0, weight to 320.0, stripeCount to 14, isPound to false, and bestFriend to null. A copy constructor that deep copies all necessary instance fields. Methods: migrate The pug moves to the opposite kind of living situation if and only if it does not have a best friend. For example, if this pug were now in a pound and it has a best friend, it would not migrate to a…arrow_forwardwrite a program to implement the above interface using Lambda Expression to accept “ Hello World” and print it 10 times. write a program to implement the above interface using Inner Class to accept “ Hello World” and print it 10 times This is my code interface interf1 { publicvoidrepeat(Strings1); } public class Main { public static void main(String[] args) { interf1 obj = (s1)-> { //using lambda expression for(int i=0;i<10;i++) { System.out.println(s1); } }; obj.repeat("Hello World"); } } public class Assignment { public static void main(String[] args) { interf1 obj = new interf1() { //inner class public void repeat(String s1){ for(int i=0;i<10;i++){ System.out.println(s1); } } }; obj.repeat("Hello World"); //function call } } But i keep getting this errorarrow_forwardwrite a program to implement the above interface using Lambda Expression to accept “ Hello World” and print it 10 times. write a program to implement the above interface using Inner Class to accept “ Hello World” and print it 10 times This is my code interface interf1 { publicvoidrepeat(Strings1); } public class Main { public static void main(String[] args) { interf1 obj = (s1)-> { //using lambda expression for(int i=0;i<10;i++) { System.out.println(s1); } }; obj.repeat("Hello World"); } } public class Assignment { public static void main(String[] args) { interf1 obj = new interf1() { //inner class public void repeat(String s1){ for(int i=0;i<10;i++){ System.out.println(s1); } } }; obj.repeat("Hello World"); //function call } } But i keep getting this error Exception in thread "main" java.lang.NoClassDefFoundError:…arrow_forward
- 2. Write a java program to enable 1-way communication where a String is passed from client. Server counts and prints the number of vowels and consonants in the string received from client. 3. Write a java program to demonstrate session tracking. 4. Write a Java program to implement Lambda Expression with multiple Parameters. Let both the types of parameters be Strings. 5. Write a Java program to implement a superclass Shape and its subclasses Square, Rectangle and Triangle. Calculate the area of each shape using abstract classes and methods.arrow_forwardWrite a set of Java classes that can simulate an Internet application in which one party, Alice, is periodically creating a set of packets that she wants to send to Bob. An Internet process is continually checking if Alice has any packets to send, and if so, it delivers them to Bob’s computer; Bob is periodically checking if his computer has a packet from Alice, and if so, he reads and deletes it.arrow_forwardComplete the class LeprechaunGold to model a stash of gold coins at the end of the rainbow. There is a maximum capacity to the number of gold coins a leprechaun can store at any given time (the pot they store them in can only hold so many). The pot also holds a current amount. What does the LeprechaunGold object need to remember? Those are the instance variables. Provide a constructor that takes the maximum capacity as a parameter. The constructor initializes the instance variables (two of them). Provide methods public int getCapacity() - gets the maximum capacity public int getAmount() - gets the number of coins in the pot public void donate(int coins) - simulates making a donation public void save(int coins) - simulates adding more coins to the potarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education