Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

Java, Programming

  • Category:- Java
  • Reference No.:- M91526097
  • Price:- $130

Guranteed 48 Hours Delivery, In Price:- $130

Have any Question?


Related Questions in Java

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As