Ask Programming Language Expert

Introduction

This assignment builds on your application, produced in Assignment 1, which holds a list of cabins, which can be either read in from a text file or just hard coded in a ‘populate' method. The statistical reports in Assignment 1 are not needed in this assignment. Contact the lecturer if you do not have a suitable ‘list of cabins' program.

Unlike assignment one, you should work on this assignment yourself, but you are of course welcome to discuss it with other students.

The Application

You should develop your program using incremental development. Develop your program a little bit at a time and keep testing it. Save a working version before making the next set of alterations. Then, if you run out of time, you can submit a program which provides some of the functionality. You will get very few marks for handing in lots of code that does not run correctly.

All code should be well-designed, well-laid out and commented.

Conditions for this coursework

All students MUST complete coursework to a satisfactory standard, you are not allowed to pass the course just on the examination alone, even if you score 100% in the exam which will give you 60% for a course mark. If you don't do the coursework this semester, you will be asked to do it later, although it wouldn't then count towards your final mark.

If you hand in work late, without extenuating circumstances, 10% of the maximum available mark will be deducted from the mark awarded for each day late.

Part One - UML Use case Diagram, Text description and Activity Diagram

You can draw these diagrams using any tool that you like - a UML tool, a drawing package, or by hand.
The scenario below is JUST for the use case and activity diagrams - the application that you are asked to write is a little simpler.
Draw a Use Case Diagram for the following scenario, and write a detailed description of the ‘book-in' use case - this is the numbered ideal scenario with alternatives (see slide 10 of Use case lecture). There are probably several equally correct interpretations of this scenario, so don't worry if you don't all have identical diagrams.

A campsite has a number of cabins which can be hired on a daily basis, and a number of grass plots for tents, caravans or motor homes. Cabins and plots will be referred to as ‘locations'. Travellers aged under 18 are not allowed to stay on this campsite.
Travellers cannot book in advance at this campsite, they just turn up and, as long as there is a free location, they are allocated a cabin or plot. When they arrive, they fill in a ‘visitor form' giving their personal details, and show their passport (which includes their date of birth). While they are doing this, the campsite staff fill in another form on the computer just entering the location id and the form number, and how many nights they are staying for. The traveller must pay the cost of the location for one night when booking in. Then the traveller is shown where their location is.

If the traveller wishes to stay an extra night, he must pay for that in advance. This can be done either when booking in, or at a later stage.
The campsite has a manager and several assistants. All campsite staff can book in travellers, and handle payment. In addition, the manager can view various reports on occupancy and income.

Draw two activity diagrams: one for the book-in use case, and one for some coding involving decisions in your application, for example the getCost() method.

Part Two - using Inheritance

Write your initial Plot class anytime, continue after the 3 inheritance lectures.

Keep a copy of Assignment One before continuing!
You are NOT being asked to develop a complete booking system here. You are not expected to cope with payment at all, or restrict access according to the type of user.

First write a Plot class and test using a main method, not using inheritance at all:
Decide on a small amount of information to keep for each plot. E.g. plot number, whether it has electricity or not, something else. Decide on a very simple calculation to work out the cost of each plot depending upon its attributes. Write a getCost() method. As in assignment one, your decisions should be different to those of your friends.

This application will only record whether a location is booked for the current night or not, and keep a count of how many times each location has been used. Now create a Location superclass and adapt your Cabin and Plot classes to become subclasses of Location. Test using a main method:
Use a superclass Location with subclasses Cabin and Plot.

The Location class includes any common attributes or methods shared by Plot and Cabin. One of these methods must be an abstract getCost() method.

In the Location class, also add in a boolean instance variable to show whether the location is booked or not for this night, and a count of the number of bookings for this location. Imagine that each day the computer is switched on and this booking boolean starts at ‘false'. Then when the traveller arrives, the booking is entered into the computer - this simply sets the booking boolean to ‘true' and increases the count of bookings for this location.

You need to alter your Cabin and Plot class so that they extend Location, and move any common attributes or methods to the Location class. Here is one way in which you could handle the ID: refer to the cabins using the prefix ‘C', and plots with the prefix ‘P'. So that, whereas before, cabins were numbered 1,2,3 etc, now locations are numbered C1, C2, C3, ......P1, P2, P3.....etc.

The Location class should return a String consisting of the location information (id, booked or not, count of bookings).
The Cabin and Plot class should have methods which return full details of the cabin or plot, and including the location information.

Extend your ‘list of cabins' application to become a ‘list of locations'. Read in cabin and plot data from 2 separate text files. For this application, you can assume that your text files contain correct data - you don't need to do any checking. You don't need methods such as min/max/total. You will need methods to:
• Search for a location given the id. This returns a Location object that you can use in other methods
• Return a String containing summary information for each location

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9525539

Have any Question?


Related Questions in Programming Language

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

  • 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