We developed a stringlog adt it represents a log that holds

Assignment Help JAVA Programming
Reference no: EM13346340

We developed a StringLog ADT. It represents a "log" that holds objects of class String. Suppose that instead of restricting ourselves to strings, we decided to create a  "log" that holds objects of type Object. Describe the changes you would have to make to each of the following classes to implement such a change.

a. Change StringLogInterface to ObjectLogInterface

b. Change ArrayStringLog to ArrayObjectLog

c. Change ITDArrayStringLog to ITDArrayObjectLog

d. Change LLStringNode to LLObjectNode

e. Change LinkedStringLog to LinkedObjectLog

Write a class Array that encapsulates an array and provides bounds-checked access. The private instance variables should be int index and inarray[10]. The public members should be a default constructor and methods (signatures shown below) to provide read and write access to the array.

 void insert(int location, int value);

 void retrieve(int location);

If the location is within the correct range for the array, the insert method should set that location of the array to the value. Likewise, if the location is within the correct range for the array, the retrieve method should return the value at that location--the approach taken by the library before Java 5.0. In either case, if location is not within the correct range, the method should throw an exception of class ArrayOutOfBoundsException. Write an application that helps you test your implementation. Your application should assign values to the array by using the insert method, then use the retrieve method to read these values back from the array. It should also try calling both methods with illegal location values. Catch any exceptions thrown by placing the "illegal" calls in a try block with an appropriate catch. Share your code with classmates and compare and discuss the various implementations.

 

UML Exercise

 UML Exercise: Automated Teller Machine (ATM)

Brief Statement of Purpose:

An ATM is an electronic device designed for automated dispensing of money. A user can withdraw money quickly and easily after authorization. The user interacts with the system through a card reader and a numerical keypad. A small display screen allows messages and information to be displayed to the user. Bank members can access special functions such as ordering a statement

 Brief Summary of Requirements:

 The ATM is required:

 1. To allow authorized card holders to make transactions

1. Card holders shall view and/or print account balances 

<!--[if !supportLists]-->2. <!--[endif]-->Card holder shall make cash withdrawals 

<!--[if !supportLists]-->3. <!--[endif]-->Card holder shall make cash or check deposits 

4.     Card holder shall quit session 

2. To allow bank members to access additional, special services 

1. A bank member shall be able to order a statement 

2. A bank member shall be able to change security details (e.g. PIN number) 

3. To allow access to authorized bank staff 

1. Authorized staff can gain access to re-stock the machine

2. Authorized staff are able to carry out routine servicing and maintenance

4. To keep track of how much money it contains and alert bank staff when stocks are getting low. 

 Additional Notes:

Users shall be able to access the ATM by punching in their account number and PIN. Once the system has verified that the account is active and the PIN matches with the account number, the system offers the users four choices. Users can withdraw money, deposit money, check balance or quit the session.

The user must have a minimum of $100 in his / her account. At the end of any transaction a printed copy of the transaction is provided to the user. A transaction could be - withdraw money, deposit money or check balance. Once the user has completed a transaction, the system offers the user the same four choices, until the user decides to quit.

The system shall interface with the device to dispense cash, the device to accept cash or check and the printer. Since we have not studied databases in this course, the system will keep all the information in two RandomAccess files. One file will hold the passwords and the other account balances.

  • Identify and list the actors
  • Identify and list the uses cases
  • Draw the top level Use-Case diagram
  • Give a detailed Use-Case analysis for one use case. Your analysis should contain a brief description of the use case, the basic and alternative flows, pre and post conditions.
  • Identify and list nouns of the system to assist in developing initial Class diagram
  • Draw initial Class diagram
  • Draw Sequence diagram

Chapters

1. 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!. For example, if the input is 4, the output could be:

4! = 4! 

= 4 * 3!

= 4 * 3 * 2!

= 4 * 3 *2 * 1!

= 4 * 3 * 2 * 1 * 0!

2. Explain the relationship between dynamic storage allocation and recursion.

3. Based on the Queue ADT specification, an application programmer has two ways to check for an empty queue. Describe them and discus when one approach might be preferable to the other approach.

4. Discuss the relative efficiency of the enqueue and dequeue operations for fixed-front and floating-front approaches to an array-based implementation of a queue.

5. This discussion is based on The Card Game of War application case study in Chapter 5. Implement the program and answer the following:

a. Can a game of War end in a tie? If not, why  not? If so, explain how, and describe what our War program would do in that case.

b. When you play cards, you normally shuffle the deck several times before playing. Yet the shuffling algorithm used in our program walks through the array of cards only once. Explain the difference between these two situations.

c. Suppose only four cards are dealt in a game of War, two to each player. Describe a deck of four cards, such that when dealt, will result in a game of War that continues forever.

d. In the play method of the WarGame class, what is the effect of removing the shuffle method invocation?

Chapter

1. Suppose we have a Rectangle class that includes length and width attributes of type int, both set by the constructor. Create a compareTo method for this class so that rectangle objects are ordered based on their a) Perimeter, and b) Area.

2. Give examples from the "real world" of unsorted lists, sorted lists, indexed lists, lists that permit duplicate elements, and lists that do not permit duplicate elements.

3. Someone suggests that, instead of shifting list elements to the left when an object is removed, the array location holding that object should just be set to null. Discuss the ramifications of such an approach for each of our three list types.

4. Can the linear search algorithm be encoded using recursion? If not, why not? If so, outline an approach and discuss its advantages and disadvantages. Share your thoughts with others in the class.

5. Expand the RefUnsortedList class (section 6.7) with a public method endInsert, which inserts an element at the end of the list. Do not add any instance variables to the class. The method signature is: 

public void endInsert(T element)

Reference no: EM13346340

Questions Cloud

In this project you will create an application to run in : in this project you will create an application to run in the amazon ec2 service and you will also create a client that
1give five illustration of securities that are exempted : 1.give five illustration of securities that are exempted from the registration provisions of the 1933 act.2.in the
Report describe the ways in which timely and accurate : report describe the ways in which timely and accurate financial data provide a powerful tool for managers to use in the
It is analysed projected financial data and assessed its : it is analysed projected financial data and assessed its value to making a physical expansion decision. as you have
We developed a stringlog adt it represents a log that holds : we developed a stringlog adt. it represents a log that holds objects of class string. suppose that instead of
Company background from small beginnings in hong kong 1981 : company background from small beginnings in hong kong 1981 giordano international limited expanded throughout the asia
Task 1 complete the following questions1 how much needs to : task 1 complete the following questions1. how much needs to be invested today if your goal is to have 100000 five years
The increase in mobile phone use in recent years has : the increase in mobile phone use in recent years has transformed the way we live communicate and do business. mobile
Your company is considering using the payback period for : your company is considering using the payback period for capital-budgeting. discuss the advantages and disadvantages of

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