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

Lalr parser - xml table output, LALR Parser: Rule Table - Contains de...

LALR Parser: Rule Table - Contains definitions of production rules within the grammar. Attributes: Count - Number of production rules in the table Child items:

What is jvm-java virtual machine, What is JVM-Java Virtual Machine  A J...

What is JVM-Java Virtual Machine  A JVM stands for java virtual machine. This is virtual computer or an abstract computer that runs the complied java programs. In fact JVM is

Ws-addressing, WS-Addressing, WS-Reliable Texting and WS-Security WCF tools...

WS-Addressing, WS-Reliable Texting and WS-Security WCF tools many innovative Web solutions (WS) expectations such as WS-Addressing, WS-Reliable Texting and WS-Security. With the di

Motion field matlab with quiver, how to get the HORIZONTAL motion field fro...

how to get the HORIZONTAL motion field from motion vectors matrices

Series solutions - higher order differential equations, The idea of this se...

The idea of this section is not to do anything new along with a series solution problem.  Instead this is here to exemplify that moving in a higher order differential equation does

Assembly language coding, i need a coding to glow 8 LEDs on a port with pwm...

i need a coding to glow 8 LEDs on a port with pwm effect

Design and implement a character analyser, Your task is to write an applica...

Your task is to write an application to analyse texts in a file.  Your application will employ  several kinds of text-analyser objects (which you also have to implement)  as descri

Introduction to javascript, This is the programming language of the Web. It...

This is the programming language of the Web. It is mainly used for validating forms. JavaScript & Java can be associated to each other. There exist several other differences betwee

Modularity, Modularity, Abstraction, and Modelling Whether proving a t...

Modularity, Abstraction, and Modelling Whether proving a theorem by creating up from lemmas to simple basic theorems to more accurate results, or designing a circuit by creati

Discuss the php operators, Question 1 Explain the history of Internet ...

Question 1 Explain the history of Internet Question 2 What are the advantages of DHTML? Question 3 Explain the concept of DOM Question 4 How does AJAX work

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