
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question

Transcribed Image Text:Problem Description
Peter Pan needs a reliable translator to encode messages to evade his nosy pirate adversaries, and he
needs your help! You will implement a translation system that can handle his diverse linguistic needs. To
do that, you will write three classes (the name of each is bolded below).
The Message class is at the core of the translation system. A Message stores a message and the
dialect it's encoded into. A Dialect enum defines all supported dialects, where each dialect has its
own set of rules governing the translation of messages. Additionally, the Message class maintains a
running count of how many messages have been translated to each dialect at any point in time.
Message exposes a public translate method that translates the original message into its specified
dialect. It defines other private methods that handle the translation logic for each specific dialect. Note
that a Message should not be considered translated until the first call to the translate method on that
object.
Message also exposes a method that returns the counts of messages translated into each dialect
across all instances.
The Peter Pan class is the driver program for the translation system. It's responsible for creating
messages with various dialects and displaying the translations along with other information. It enables
live input from the user for message content and dialect selection, offering a more engaging and
interactive experience.
Lastly, for this homework and all future ones, we will require you to Javadoc your code. The Checkstyle
section toward the end of the document discusses this some.

Transcribed Image Text:Solution Description
In the interest of encapsulation, data members for each of the following classes should only be
accessible from other classes using getters and/or setters where needed. The described methods and
constructors for this assignment should be public. It is OK to write private helper methods for your
classes, however.
Your solution will consist of three files:
Dialect.java
Message.java
Peter Pan.java
Dialect.java
Defines an enum that enumerates three dialects: PIRATE, ELMER_FUDD and COMPUTER.
Message.java
The Message class is the central component of the translation system, managing individual messages
by encapsulating their dialect and content. To instantiate a message, a client must provide the dialect
and original string message (in that order). Message should include methods to translate messages
into each of its three supported dialects respectively, while allowing the user only to interface with it
through the general translate method. (Think about what that means.)
A Message has the following attributes:
1. A dialect
2. The message (two versions)
a. Holds the original, unmodified message before translate has been called
b. Holds the translated, modified message once translate has been called
3. A true/false value specifying whether translate has been called yet for this message
Further, the Message class will track the values below across all instances:
1. The count of messages translated into Elmer Fudd dialect
2. The count of messages translated into Pirate dialect
3. The count of messages translated into Computer dialect
Each of the counts will start at 0.
You should initialize all instance variables in the constructor (consider hat value the true/false flag
should initially assume).
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
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
- Inheritance, Polymorphism, ArrayLists, Throwing Exceptions The UML diagram below shows a set of classes designed to represent a music collection from 1995. The constructors and methods all function in the standard way, except: The equipmentRequired method should return “Record Player” or “CD Player” as appropriate.The getAlbum method of the NinetiesMusicCollection class accepts an index and returns the corresponding Album object. This method throws an IllegalArgumentException if the index is out of range. (This is the only exception you have to throw anywhere in your code.)In the NinetiesMusicCollection constructor, you can assume the ArrayList<Album> object passed as an argument is not null . Don’t worry about privacy leaks.Implement this set of classes in Java. Note the italics on the Class name “Album” and the method name “equipmentRequired” in the Album class.arrow_forwardImplement a nested class composition relationship between any two class types from the following list: Advisor Вook Classroom Department Friend Grade School Student Teacher Tutor Write all necessary code for both classes to demonstrate a nested composition relationship including the following: a. one encapsulated data member for each class b. inline default constructor using constructor delegation for each class c. inline one-parameter constructor for each class d. inline accessors for all data members e. inline mutators for all data membersarrow_forwardin c++ Define another new class named “Item” that must inherit from the given Name class. This Item class will manage the following info: name (string) and price (double). It must prevent the creation of an Item object with either an empty or all-blank name. This class must at least complete the methods defined in the Name class: toString method returns a string representation of the Item object in the format of “ITEM( <name> ) PRICE($ <price> ) such as ITEM(eraser) PRICE($1.05) contains method that accepts a search string and returns true if only the name of the item contains the search string as a substring. It returns false otherwise. isTheSame method that compares two Item objects and returns true only if both Item objects have the exact same name (regardless of the price) and false otherwise. Please note that if the given object in the parameter is not an Item object, it will return false.arrow_forward
- In C++ create a program that acts like a bank account. It asks the user whether to deposit or withdraw. That has 3 classes. The first class must be a generic class that holds basic info deposit, withdraw, calculate monthly interest rate, and a monthly service fee.The second class must be a savings account class that if the savings account falls below $25 it becomes inactive. The final class must be a checking account if someone withdraws more than what they have a service charge of $15 is added and go into a negative balance. The output should display the basic information how much someone deposited or withdrew and their monthly interest rate.arrow_forwardSolve the questionarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- 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

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education