Develop an application to hold details of all the cabins

Assignment Help JAVA Programming
Reference no: EM13865385

Overview

A holiday resort provides cabins for travellers to stay in overnight.

A ‘cabin' is a small wooden hut, containing bunk beds, table and chairs, a heater, and a small cooking area. Often the traveller will use the general campsite facilities for washing and showering. Some cabins are more expensive, and may have separate bedrooms and their own ensuite bathroom.

Each cabin has a fixed price, regardless of whether all the beds are used or not. Small cabins are usually hired by individuals or couples, larger ones by families. Travellers hire the whole cabin, not a bed in a cabin.

Each cabin has a named owner. For this course, you can assume that owner names are unique.

In this assignment you will develop an application to hold details of all the cabins on the site, including their cost per night, and produce a report which includes a list of cabins and some summary statistics.

You should be able to make a start on your Cabin class after the first few lectures, and you will be able do most of the assignment after ArrayLists have been covered. You can finish it after the lecture on file i/o and exceptions.

In other accommodation types e.g. Hotel-room you should focus on using fields, which refer to a realistic booking option, e.g. Double room or single room.

Stage One - development your cabin class

The application is all about cabins, so there should be a cabin class. Develop your cabin class, and, using a main method, create several cabins and test the methods.

Don't use input or output files or any sort of graphical user interface in this stage. Just develop your cabin class, without the list of costs. Using a main method, create several objects of the class, and test all your methods, which you will use in the next stage.

Details for each cabin should be held in a class named either NameCabin (where Name is your initials) or some more specific name e.g. ArgyllHolidayVillage. Develop this class, according to the requirements that are listed below. Some of these requirements are described fully, and in other cases you have to make some of your own decisions.

When you have to make your own decisions, don't make the same decisions as your friends. You will lose marks if you hand in work in which all design decisions and code structures are identical to those of other students.

Your cabin class - Instance variables

For each cabin, you should hold the following essential information in instance variables:
• Cabin number e.g. 8
• Number of beds, from 2 to 8.
• Facilities - decide on two or three categories of cabin which will affect the price. For example, whether ensuite or not.
• Owner - just store the name, and assume this will be unique. Use the Name class.

You should also include some extra information (choose this to make your coursework a little different from that of your friends). Students working alone should include 2 extra items, and students working in pairs should include 4 extra items. Suitable extra information might be related to appearance, age or size. But you can choose anything sensible. There are classes in java to store dates, but they are a little complicated, so for this assignment you could either: investigate how to do this; restrict date information to the year; not store date information.

Your cabin class - Methods

The cabin class should have (use exact method names please):

• A Constructor, and get and set methods.

• A getCost() method which returns the cost of the cabin for one night. The cost should be the same all the year round. Invent your own pricing algorithm, which should be different to that of other students. You should take the type of facilities and number of beds into account, and maybe one or two of the extra details. Use class constants rather than literals in your calculation.

• AgetFullDetails() method which returns a String containing all the details of the cabin (including your extra attribute) as text. It should be clear what all the values are.

• AgetShortDetails() method which returns a String containing ONLY the cabin number; the cost; the owner initialsrather than full name; the number of beds in the cabin; the cost for one night.

Stage Two -alter your cabin class

In this version, all the cabins need to be hard-coded in a populatemethod, and output printed to System.out. In the final version, you will use text files.

Add and test the following features:

1. In the Cabin class, replace the simple ‘number of beds' by showing the number of beds in each room in the cabin, using an array of integers. E.g. :
• one room, 2 beds {2}
• three rooms, two with 2 beds and one with 3 {2,2,3}
There should be a method to return the total number of beds in the cabin.

2. Introduce a Managerclass and a CabinList class to contain an ArrayList of cabins, containing between 10 and 20 cabins, with features carefully chosen to test all your methods. All costs should be displayed showing 2 decimal places, e.g. 12.50. This class should include methods to:
• Return text consisting of details of all the cabins. These details should be formatted into a table, and should include the cabin number; the cost; the owner initials; the number of beds in the cabin rather than the beds per room; the cost for one night; anything else that you think should be included.
• Return a cabin object corresponding to a cabin number which is provided as a parameter.
• Return text giving full details of a single cabin, corresponding to the cabin number provided as a parameter. Use the previous search method then produce text containing all details, including the full name of the owner and full details of beds and rooms.
• Return the maximum income that the site could get per night - the sum of the cost of each cabin
• Return the cost of the cheapest cabin
• Return the cost of the most expensive cabin
• Return the number of cabins on the site
• Return a frequency report of your choice. Decide whether using a frequency array is useful for your choice. Examples:

a. The number of cabins with particular facilities

b. The number of cabins sleeping 1,2, 3, ..., 8 people

Using a main method, create several objects of the class, and test all your methods.

Stage Three

Replace your populate method with a method to read in the cabin data from a text file. Include a few errors in the text file and improve your program to cater for these errors, outputting a useful message and ignoring the line with the error.

Alter your program so that the frequency reports and other statistics obtained in (2) above are written to a text file.

You should provide a report on your program, consisting of the following information (nothing else):

1) Your decisions
a. Which extra accommodation attributes you chose
b. How the overall cost is calculated. Include an activity diagram.

2) Status report. Does your program meets the specification fully, or is it incomplete? This can be very brief (don't provide a list of everything that you were asked to do - the marker knows this). E.g.
• "This application meets the specification fully"
• "The application does everything except allowing the user to enter a accommodation number"
• "This application meets the specification almost completely but I know the cost calculation isn't always correct "
For the following lists and tables, there are examples in the Testing lecture.
• If necessary, a list of known bugs and a list of requirements that you have not implemented.
• Include a table of limitations - these are things that you decided not to handle, either through lack of time or because you think that they are unlikely to occur.
• Include a table of tests done.

3) Diagrams
• Class diagram showing all classes with instance variables, methods and associations
• A sequence diagram showing a task of your choice, but using at least 2 classes. E.g. reading the input file or creating a report.

4) Write javadoc style comments for the CabinList class, and generate the html. Hand in a printed copy of the html generated for the CabinList class.

Reference no: EM13865385

Questions Cloud

What does customs border authority entail : What does Customs border authority entail? Border authority is only done so by ‘customs officers which include, officers of Bureau of Customs of the Treasury Department, commission warrant
Organic chemistry of thermochemical processing : Provide concise answers to the following questions about the organic chemistry of thermochemical processing: 1. List and indicate the structural formula for functional groups important to biomass chemistry.
Characteristics of soil horizons : Describe the components of soil, characteristics of soil horizons, as well as processes of soil formation and development. Explain soil properties, to include soil color, grain size, structure, and moisture
Define the meaning of the term supply chain : Define the meaning of the term "Supply Chain." The term is used rather freely these days, but what does it actually mean?
Develop an application to hold details of all the cabins : Develop an application to hold details of all the cabins on the site, including their cost per night, and produce a report which includes a list of cabins and some summary statistics.
The triune brain : The Triune Brain: Your Brain The reptilian brain, the oldest of the three, controls the body's vital functions such as heart rate, breathing, body temperature and balance
Parameters and write a simple recursive subroutine : Learn to pass parameters and write a simple recursive subroutine.
Statement to explain what happened at motorola : Could you use this statement to explain what happened at Motorola when they missed the digital mobile phone market opportunity (Crockett & Elstrom, 1998)
Develop case-specific effect-cause-effect logic tree diagram : Use a systems approach to analyze OCI's performance and develop a case-specific "effect-cause-effect logic" tree diagram using the 5-Whys tool

Reviews

Write a Review

JAVA Programming Questions & Answers

  Implement avl tree

Implement AVL trees that allows both iterative traversal and recursive traversal.

  Write a java program to compute salary

Write a Java program which computes the Salary for a given number of employees. The program prompts user to enter n the number of employees.

  Concept of web based information system

Design and implement a simple and small email server using the concept of web based information system

  Java application to permit user to enter ten numbers

Write down Java application which permits a user to enter 10 numbers (double precision) into the array and then sorts and displays numbers from lowest to highest.

  Complier error and run time error

Q1. What do you understand by complier error and run time error? Explain by example.

  Digit decimal seconds counter using two 7-segment displays

Write a program that implements a two digit decimal seconds counter using two 7-segment displays.  Make this program using java programming. Make this program in simple way.

  Difference between sequential access and random access

What is the difference between sequential access and random access? What are BufferedInput/OutputStreams and why are they used? Write some Java code to illustrate how to create a BufferedInputStream

  Simulate the transactions of a checking account

create a base class, called CBankAccount, and two additional classes (each derived from CBankAccount), called CSavingsAccount and CCheckingAccount.

  Determines if the input string is a valid lock combination

Write a Java program that satisfies the given requirement - Prompts the user to input exactly nine characters, which constitute a valid lock combination.

  Write a program that starts a player off with a bank of $15

Write a program that starts a player off with a bank of $15.00.

  What is the average response time for this system?

A web server receives a request every 50ms and processes web requests every 8 ms. Using queuing theory, 1. What is the average response time for this system?

  Accounts receivable system appication

A common business application is an 'Accounts Receivable' (AR) system. Companies use an AR system to bill their customers on sales of their products

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