Delivery in day(s): 3
COIT 20245 Introduction to Programming
Here, students will get important information and guidance for their Java Console Program assessment.
Total weight of this assessment is 20%.
This assessment task associates to the learning outcomes as in the Unit Profile.
To complete this assessment, you need to write a Java Console Applicationfor Rocky Budget Hotel. The Rocky Budget Hotel is mentioned for reference purpose only. Students will find an actual organization in their assignments.
To complete this assessment, students are mandatory to make a Java Console Program to show they can use constructs containing input/output by the use of a command line, Java defined objects, Java primitive and integral data types, methods, selection and looping statements, and several other Java commands.
Students are only permitted to use techniques which have been covered in the first 6 weeks of the course. Students must use the Scanner object for input and they cannot use advanced data structures like arrays.
Students need to submit following for this assessment:
The Java source code:
A report containing a flow chart (UML activity diagram) to show your validation loop for reading the days, how long it to create, any problems faced and screenshots of the output produced. You should check every prospect in the program.
The management of Rocky Budget Hotel has asked you to write a program to support employees define the charges for customers staying at the hotel and produce some statistics.
You are required to write a Java Console Application (Hotel.java) which will permit employees to enter the details of N customers' names and the number of days to stay at the Hotel.
N should be equal to the highest digit in your student ID. Use N=3 if your highest number is less than three. For each customer the program will prompt for and accept the name of the customer and the length of stay at the hotel, then it will show the total cost of the stay (see the below-mentioned sample for formatting details).
The pricing structure for staying at the hotel is (14 days maximum):
The first day cost $110 per day.
The next 2 days will cost $100.
The next 4 days will cost $90.
The next week will cost $70.
The sliding price is to encourage students to stay longer at the Hotel; the management has imposed a maximum of 14 days stay, after that the structure of the pricing will be repeated with another booking needed.
When all customers' names and days of stay have been entered you need to report the maximum and minimum stay and the customer's name, the average stay, and the total collected charges.
The required Java Console Application should allow the user to:
1. For each N customer: enter the Name, and then the Length of stay in whole days. The program will output the charge for the customer’s stay. The program will output the charge for customers’ stay. The dollar values will be formatted to 2 decimal places (see below implementation).
2. You must make sure the name is not blank so you must execute a validation loop so that a valid name is entered. The number of days must be between 1 and 4 inclusive and you will also need to implement a validation loop so valid days are entered.
The program will number each customer in the input prompt.
3. When N customers have arrived, you’ll output a heading for the statistics “Statistical information for the Rocky Budget Hotel”, the minimum and maximum stays and the name of the customers with minimums and maximums, and then the average stay is in days (formatted to two decimal places).
Note:if more than one customer has a similar minimum or maximum stay you need to only output one of the customer's names.
4. Display a welcome message at the starting “Welcome to the Rocky Budget Hotel system” and an end message “Thank you for using the Rocky Budget Hotel system” and the final line “Program written by your student ID.
The numeric literal values N and daily rates must represent as constants.
Assessment 2 (Java Program Using Array of Objects)
Value:Total value of this assessment is 30%.
To complete this assessment, you need to create a Menu-Driven Java Program to show you can use Java constructs containing input/output via GUI dialogs, Java defined objects, built-in types, Java primitive, arrays, selection and looping statements and several other Java commands. It is necessary that your program produces correct outcomes. The menu selections are also linked to applicable methods in the given code. You must write comments in the supplied code along with your own additions.
The code for the menu and option selection is supplied: Hotel.javaand is available on the unit website, you will have to write the underlying code to execute the program.
You’ve completed the Java Console Program for processing booking at the Rocky Budget Hotel. Now you need to extend the application so that the customer’s name and days to stay at the hotel can be stored in an array of objects, don’t use ArrayList.
This program will run via a menu of options, the file Hotel.java has been supplied which supplies the fundamental functionality of the menu system.
Look at code supplied and trace the implementation and you’ll see the menu is related to blank methods (stubs) which you will execute the different choices in the menu.
The first step is to create a class called Booking (Booking.java)
The booking class will be simple and it will include two private instance variables:
a. Name as a String
b. Days as an integer
You should also have constants for the varying daily prices i.e. $110, $100, $90 and $70.
The below mentioned public methods will have to be executed:
a. A default Constructor
b. A parameterized constructor
c. TWO set methods (mutators)
d. Two get methods (Accessors)
e. A method calculatecharges ( ) to calculate and return the total charge. The calculation will be the same as in assessment one.
Note:following elementary database principles, calculated values are not generally stored.
As the booking class is executed and fully tested, now start to execute the functionality of the menu system Hotel.java
For this assessment, Declare an array of Booking objects as an instance variable of the Hotel class, the array should hold 20 bookings.
You’ll need another instance variable to keep track of the number of the booking being entered and use this for the index into the array of Booking objects.
1. Enter customer name and day to stay:enterBooking ( )
You’ll need to generate the following 2 dialogs to receive the input from the user. You will not implement the functionality of the cancel key. Use Integer .parseInt ( ) to convert the number as a string into an integer for the number of days to stay.
Data validation (you can execute this after you’ve got the implemented)
You’ll require validating the user input using a validation loop.
The name of the customer cannot be blank, not null and the days to stay cannot be blank and days requires to be between 1 and 14 inclusive, same as assessment one.
The output below mentioned error dialogs:
After the customer name and days to stay have been successfully entered into 2 local variables you’ll need to add these values to the Booking object array, you’ll also need to increment a counter to keep track of the number of bookings you’ve entered and the position in the array of the next booking to be entered.
When the maximum number of bookings is reached (20) don’t attempt to add any more bookings and give the following error message:
When the details of booking have been entered successfully, display the booking details and the charge on the console screen.
Note:for the 3 options, display all, statistics and search you should make sure minimum one booking has been entered and give a suitable error message if there are no bookings entered and for the sorting option, you must make sure minimum two bookings have been entered, for instance:
2. Display all bookings:displayAllBookings ( )
When this option is selected display all the bookings which have been entered up to now.
3. Display statistics:displaystatistics ( )
When this option is chosen you’ll display the statistics as per assessment one, you can loop through your array of objects to calculate this information.
4. Search for booking:searchBookings ( )
You can just use a simple linear search which will be case insensitive. Use the showInputDialog() method to input the name (you can share this functionality from fill name in the booking).
If the search is successful display the details about the booking.
If the search is unsuccessful display an applicable message.
5. Sort the bookings:sortBooking ( )
The option you’ll sort the bookings alphabetically by the customer names, you can use any sorting algorithm which you like, don’t use any sort methods. Display the sorted list after the sort is completed.
Remember the welcome and exit message as per assessment one.
Various challenges for students in completing this assessment:
Students face many difficulties while completing the assessment of programming like unable to understand the complete process, making references, programming, use of Scanner object for input etc. Our trained and professional programmers will help and guide you to complete your programming assignment which helps you to achieve good grades.