Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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  //

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9523817

Have any Question?


Related Questions in Programming Language

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

  • 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