Program for hold details of all the cabins for travellers, Programming Languages

Assignment Help:

Scenario

A campsite 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.

Specification

Overview

Develop an application to hold details of all the cabins on the site, including their cost per night. 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.

Development before arrays have been covered

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.

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.

getCost() method

The Cabin class should have 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 groups. 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.

Intermediate version, to be completed after arrays and ArrayLists  have been covered.

In this version, all the Cabins need to be hard-coded in a 'populate' method, 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 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 rather than full name; the number of beds in the cabin rather than the beds per room; 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
  • Each person in the group should write a method to return a frequency report of their 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

Final version after lecture on file i/o.

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. 

Extra documents

You will also be asked to hand in a report on your testing, a class diagram and a sequence diagram, and to generate the javadoc to document one class for external use.

1)      Introduction, containing:

a.       which extra cabin attributes you chose

b.      how the cost of a cabin is calculated

c.       what the frequency report(s) show and which person wrote it

d.      Status report. Tell us whether you think that your program meets the specification fully, or whether you haven't quite finished it or know that there are some bugs that you can't solve. This can be very brief.  E.g.

i. "This application meets the specification fully"

ii. "The application does everything except the frequency report"

iii. "Our application can print a list of the cabins but we haven't done any other reports"

iv. "We've done everything in the specification but we know the maximum cost isn't correct"

2) Class diagram showing instance variables, methods and associations

3) A sequence diagram showing a task of your choice, but using at least 2 classes. E.g. working out the frequency report.

4) Code. Just print each file, in a monospaced font such as Courier, from a text editor or eclipse, you don't need to embed the code into a report.

5) Comment one class to Javadoc standards and generate the html.

6) Application report output, ideally from text file. Show each feature - list of cabins, examples of single cabin details, max income, cost of cheapest and most expensive cabin, frequency reports.

7)      Testing report. This could include explanation of choice of suitable cabin attributes, details of error checks on file input, and a list of tests passed, especially for methods involving decisions.

Additionally, submit your application as a single file through the link in Vision. You could submit a zipped eclipse project or a zipped file containing your java files and input text files. It should be possible for the lecturer to run your application if they wish to do so.

Note:

You have to write comment before each step using  //


Related Discussions:- Program for hold details of all the cabins for travellers

Retrive unicode text using vb.net ado.net, How Can I Retrive Unicode CSV Fi...

How Can I Retrive Unicode CSV File the ADO.net VB.net

Included applications, Hi, Can any of you, tell me how to use Included Ap...

Hi, Can any of you, tell me how to use Included Applications?

Program to built book recommendation system, 1 Problem Description The...

1 Problem Description The task of the assignment is to build a book recommendation system for Auer Libraries. The system is to be implemented in Prolog and as the owners of t

Java applet assignment help, Objectives: Create an applet, Use metho...

Objectives: Create an applet, Use methods from the Graphics class , Use the Color class General Instructions: The java class that need to be imported into this assignm

Oop, Using OOP,write a sample program to get the factorial of a number ente...

Using OOP,write a sample program to get the factorial of a number entered by a user

Cobol, i have 4 variables in my linkage section of PIC 9(3) ..while submitt...

i have 4 variables in my linkage section of PIC 9(3) ..while submitting i m passing parameter value i.e. numeic to them but its taking space for 2 varaible and for two its taking c

Program 3, An apartment complex has several apartments to rent. The apartme...

An apartment complex has several apartments to rent. The apartments are all similar, and all rent for $750 per month. Currently, all units are occupied. The management, being in bu

Language-integrated query, Language-Integrated Query Language integrated qu...

Language-Integrated Query Language integrated query (LINQ, obvious "link") is a Enthusiasm .NET Structure element that contributes ancient data querying abilities to .NET dialects,

Define a procedure that takes a list as a single argument, (a) Define a pro...

(a) Define a procedure (subsets x) that takes a list as a single argument and returns all 2^n subsets of that list, i.e. the power set of the list; e.g. (subsets '(a b c)) ==> (

Write Your Message!

Captcha
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