Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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 

2. Card holder shall make cash withdrawals 

3. 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)

Java, Programming

  • Category:- Java
  • Reference No.:- M9130687
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in Java

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As