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

Sizes of the clusters influence-k-means program, Objective: to show if th...

Objective: to show if the sizes of the clusters influence the communication cost among a set on nodes Write a K-Means  program  for a set of M points randomly distributed on an

Hb programming test, The purpose of the HB Programming test is to assess wh...

The purpose of the HB Programming test is to assess whether a candidate has sufficient knowledge to join our team here and beyond that where they would fit within our teams. The

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

Develop a diagram to model functionality, Develop (i) a context diagram, an...

Develop (i) a context diagram, and (ii) a use case diagram to model the following functionalities of an online brokerage house. eBroker is a discount online broker. An account h

Otrs customisation using perl, OTRS Customisation using Perl, MySQL Program...

OTRS Customisation using Perl, MySQL Programming OTRS is a perl based open source issue ticket management solution. Default performance features 'note-internal' that is visible

Python , Return a new picture with each pixel''s color values made up of 80...

Return a new picture with each pixel''s color values made up of 80% of the color values of the corresponding pixel in the first picture and 20% of the color values of the

Explain the break statement - computer programming, Explain the Break State...

Explain the Break Statement - Computer Programming? The break statement is used as an interrupt to the normal flow of control this statement causes as exit from the switch stat

Software engineering, Assigment 01 Subject Code: ITE 2106 Subject Name: Sof...

Assigment 01 Subject Code: ITE 2106 Subject Name: Software Engineering You run a software development organization catering to external clients to build software solutions. The bus

Prolog predicate to remove nth element, Write a Prolog predicate remove_nth...

Write a Prolog predicate remove_nth(N,L1,L2) that is true if list L2 is just list L1 with its Nth element removed. If L1 does not have an Nth element then the predicate should fail

Nature of the empirical data in pascal programming, You will soon receive i...

You will soon receive in an email a personalized assignment that tells you the nature of the "Empirical Data" you are to produce with a Pascal program for HW3. HW3 is about generat

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