Define a new run-time exception named

Assignment Help JAVA Programming
Reference no: EM131589060

Edit the Dictionary class to include exceptions so that when you run the class DictionaryTest, all tests pass. For example, the method put in the class Dictionary should include the following exception handling:

public void put(String key, Token value) {

if (key == null || value == null) {
throw new NullPointerException("key or value is null");
}

if (count == elems.length) {
increaseCapacity();
}

// Similarly to the array-based implementation
// of a stack, I am adding elements at the end
elems[count] = new Pair(key, value);
count++;
}

LukaSyntaxException

  • Define a new run-time exception named LukaSyntaxException.
  • Make changes to the class Interpreter so that when the following situations are detected, an exception of type LukaSyntaxException is thrown.
    • When an illegal symbol has been found. All illegal symbols are symbols that is nor a reserved keyword (operation), nor an existing association in the dictionary.(Note nor is a Boolean operator that gives the value one if and only if all operands have a value of zero and otherwise has a value of zero.)
    • When undefining a non-existing association.
    • When updating a non-existing association.
  • The class Interpreter will display the appropriate messages, including:
    • The symbol table.
    • Operands stack.
  • Make changes to the class Viewer so that exceptions of type LukaSyntaxException are caught. When catching the exception, the method displays the type of the exception and its message. Finally, the application exits.

For instance, upon executing the following Luka program:

/x 1 def /y 2 def x y /z 3 set

The application would print the following information and exit.

LukaSyntaxException: 
Dictionary: {elems = [{key=y,value=2}, {key=x,value=1}]}
DynamicArrayStack: {3,z,2,1}
ILLEGAL SYMBOL: set
caught LukaSyntaxException

Attachment:- Luka.zip

Reference no: EM131589060

Questions Cloud

What is the default primary group for each user : Which file stores user accounts? Which file contains the passwords for each user account - What is the default primary group for each user
What are management process strategies : What are management process strategies? Explain two stratagies that improve organizational management. What are examples of business that use them?
Review the developmental model of intercultural sensitivity : Review the Developmental Model of Intercultural Sensitivity on pages 81-85 of the Learning through Serving text.
Describe three primary reasons companies engage in business : Describe three primary reasons companies engage in international business. What is culture shock and how does it affect international business?
Define a new run-time exception named : Dictionary class to include exceptions so that when you run the class DictionaryTest, all tests pass. For example, the method put in the class Dictionary
Which of these two theories feels the most comfortable : Pretend you are good Utilitarian who is more interested in the results than in the intention to do the right thing, what course of action would you take ?
Components of aggregate demand : What components of aggregate demand were affected and what was the impact on real output? What were the policy options?
What response or solution does the hgp provide criticisms : What response or solution does the HGP provide for the concerns and criticisms of the above issue. Do they identify any of their own concerns
Briefly describe how a company is using the strategy : Briefly describe how a company is using this strategy, and provide your own observation (why are they doing this? Do you think it will be effective?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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