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 a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Why do i not create a constructor for an applet

When should one use applets and when should one use servlets? Why do I not create a constructor for an applet? Why doesn't appletviewer appletclass.class work?

  Object from question 1 manage its display

Write a Java statement to have the object from question 1 manage its display area by dividing it into 3 rows which have 4 columns each.

  Determine total annual compensation of a salesperson

Write a Java application using NetBeans Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors: A salesperson will earn a fixed salary of $45,000

  Write an isr and startup code for a system

Write an ISR and startup code for a system that lights up LED0 on the PSoC Eval1 board (assuming that a wire is connecting P1[0]) to show "Low Voltage" whenever there is a supply voltage monitor interrupt.

  Executing stringed musical instrument class

Create and execute a stringed musical instrument class.

  Write java program that calculates total order for customer

Write a Java program that calculates the total order for a customer. The order should include the details of buying several products. For each product (item), there should be a product code, product price, product description, and product icon.

  Evaluate the average temperature for the month

Write a program that stores the daily temperatures for the month of April in an array name dailytemp. Evaluate the average temperature for the month and the count the number of days

  Dijikstra for undirected graph using simple scheme

Dijikstra for undirected graph using simple scheme with array and fibonacci heap and compare the performance/results, preferably in java.

  Create exception classes

First, create three exception classes named NumberHighException, NumberLowException, and NumberNegativeException. Both NumberHighException and NumberLowException should be directly subclassed from the Exception class, but NumberNegativeException s..

  T an array using insertion sort and track the number of swap

How to sort an array using insertion sort and track teh number of swaps during the sorting

  Xml assignment help please follow instructions in the

please follow instructions in the attached assignment instructions. ltbrgtplease follow instructions in the attached

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