Get Cheapest Assignment in Australia, UK, US, UAE, Canada and NZ Order Now

COIT 20245 Introduction to Programming

0 Comments

Assessment item 1—Java Console Program

Due date:Week 7 T322 Midnight, Friday 6 January 2023 Refer below for complete assessment item 1 requirements. (Assignment One)ASSESSMENT
Weighting:20%1
Length:N/A

Objectives

This assessment item relates to the course objectives as in the Unit Profile.

Details

For this assignment, you are required to develop a Java Console Program to demonstrate you can use Java constructs including input/output via a command line, Java primitive and built-in data types, Java defined objects, selection and looping statements, methods, and various other Java commands. Your program must produce the correct results.

You are only allowed to use techniques which have been covered in the first six weeks of the unit, you must use the Scanner object for input and no advanced data structures like arrays will be used. Instructions for this appear in the implementation section of this specification.

If you do not only use techniques from the first six weeks of the unit you could lose substantial marks.

What to submit for this assignment:

The Java source code:

o   Yeppoon Cabins.java

A report including a flow chart (UML activity diagram) to depict your validation loop for reading the number of nights (not the whole program), how long it had taken to create the program, any problems encountered, and screenshots of the output produced. (Use Alt-PrtScrn to capture just the console window and you can paste it into your Word document). You should thoroughly test your program and outline your testing plan and annotate your screenshots with what you are testing.

Important: For this assignment, you are required to paste your source code (as text) in an appendix into your report, do not worry about the formatting loss. If you do not paste your source code as text (no screen shot images) you could lose substantial marks.

o   ReportAss1.docx

You will submit your files by the due date using the “Assignment 1 Submission” link on the Moodle unit website in the Assessment Block or in the assessment tile.

Assignment specification

Yeppoon Cabins program.

Image source: queensland.com via Google

Yeppoon Budget Cabins are offering cabins at $89.95 per night. For each booking irrespective of the number of days there is a one-off cleaning fee of $20.00.

If the customer books one night, the total charge will be $109.95, two nights will be $199.90 etc.

To encourage customers to book more nights, the management has decided to give a ten percent discount for a booking with more than seven nights and a fifteen percent discount with a booking of more than fourteen nights on the total nights of stay charge. This will not apply to the one-off cleaning fee.

You are to write a Java Console Application (YeppoonCabins.java) which will allow staff to enter the details of N booking names and the number of nights. N should be equal to the highest digit in your student ID, use N=3 if your highest digit is less than three. For each booking the program will prompt for and accept the booking name and the number of nights, it will then display the charge (see sample output below for formatting details).

When all the bookings have been entered you need to report the maximum and minimum number of nights per booking and the relevant booking name, the average number of nights per booking and the total charges which have been collected.

The required Java Console Application should allow the user to:

  1. For each of the N bookings: enter the booking name, and then enter the number of nights. The program will output the charge for the booking. All dollar values will be formatted to two decimal places (see implementation below with help for doing this).
  2. You must ensure the booking name is not blank so you must implement a validation loop to ensure that a booking name is entered. For this assignment, there is no need to ensure the name is a valid name (e.g. entering 1 for the name would be allowed). The number of nights must be greater than or equal to one and you will also need to implement validation loop to ensure that a valid number of nights is entered.

Sample pseudocode for a validation loop:

Prompt and read a value WHILE the value is incorrect

PRINT error

Prompt and read a value (again) END WHILE

The program will number each booking in the input prompt.

  • When N bookings have been entered, you will output a heading for the statistics “Statistical information for Yeppoon Cabins”, the minimum and maximum number of nights booked and the booking names with these minimums and maximums, and then what the average number of nights per booking is (formatted to two decimal places) (see sample output below). Note: If more than one booking has an equal maximum or minimum nights you just need to only output one of these cases.
  • Display a welcome message at the beginning “Welcome to the Yeppoon Cabins Management System” and an end message e.g. “Thank you for using the Yeppoon Cabins Management System” and the final line “Program written by <your student ID>” (see sample output below).

The numeric literal values N, number of nights for the different discount levels, discounts and nightly cost must be represented as constants.

Implementation

Many students have never written a program before so this is a fairly simple assignment which can be written in the main method of your class. Follow the steps outlined here and build your program up in a step-by-step fashion and always compile your program at each stage so you are always working on error-free code.

Start by creating your Yeppoon Cabins class which will contain just the main method, COMPILE! (Fix any errors and repeat).

Please include a header comment which includes your name, student ID, date, filename and a brief description of the program.

Implement the welcome message, COMPILE, RUN and TEST! Declare your Scanner object(s), COMPILE!

Note: In order to combat the problem of the Scanner objects reading both textual and numeric data a good way to counter this is to declare two Scanner objects, one for reading text and another for reading numbers, or you can clear the buffer after the int read using nextLine(). This might not be considered “best practise” but will be sufficient for this unit.

Create a loop to iterate N Times, COMPILE, RUN and TEST! (use N = 3 for development)

Declare variables to hold the booking name and the number of nights (String and int), COMPILE, RUN and TEST!

Within the loop: prompt and read the booking name, COMPILE, RUN and TEST! Add the prompt and read for the number of nights, COMPILE, RUN and TEST!

Calculate the booking charges using the discount structure above, COMPILE, RUN and TEST until this is correct.

Output the description of the booking (see sample output below) Output all dollar values and average to two decimal places:

USE: System.out.printf(“%.2f”, charge);

Add the validation loops for reading the data (you can do this last if you like)

Use if statements to determine if the number of nights is a maximum or minimum, (you will have to think about this). Output the minimum and maximums after the loop, COMPILE and RUN until you have this correct. You may want to set your original max and min variables to the minimum and maximum integers values using Integer.MIN_VALUE and Integer.MAX_VALUE.

You will need to add up the number of nights booked as you go so you can calculate the average. After the loop, you will output the statistics which you have gathered in the loop. You should have the maximum and minimum number of nights and the corresponding booking names and the total amount of charges collected.

Calculate the average number of nights per booking (ensure you are performing a floating-point calculation).

Output the statistics as indicated in the screen shot below. Finally, print the end message.

Your program should be well laid out, commented, and use appropriate and consistent names (camel notation) for all variables and objects.

For this assignment, you will not worry about checking data type mismatches.

Refer to a Java reference textbook and the unit and lecture material (available on the course WEB site) for further information about the Java programming topics required to complete this assignment. Check the marking guide (last page) to ensure you have completed every task. You need to match the output as shown below including line spacing.

Typical screen shot of the program executing is as follows:

Good luck — Bruce McKenzie unit coordinator Term 3 2022 b.mckenzie@cqu.edu.au

Marking Scheme

 Marks allocated
Total number of marks – 20 
Variables, constants and types 
Constant N is used correctly and is largest digit of student ID0.5
Constants are used for all numeric literals (no hard-coded values)  1.5
Variables have meaningful names and use camel notation0.5
Variables are the correct type0.5
Code in general 
Code is indented and aligned correctly0.5
Code has header comment which includes your student name, student ID, date, file name and purpose of the class  0.5
Comments, non valued comments will not receive full marks1
Input 
Numbers and strings are read correctly0.5
Validation loop for booking name is correct1
Validation loop for number of nights stay is correct1
Processing 
if statements are correct0.5
looping is correct i.e iterates N times0.5
Output 
Output is formatted correctly (matches sample output)1.5
Correct charge per booking is correct1.5
Minimum nights and booking name are correct1
Maximum nights and booking name are correct1
Average nights per booking is correct1
Total charges is correct0.5
Average and dollar values formatted to two decimal places1
Welcome and exit message (with student ID) are displayed0.5
General 
Correct files submitted including types and names0.5
Report 
Flow chart is correct1
Screen shot(s) of testing, testing plan and annotations1.5
Report presentation and comments including how long it took and any problems encountered  0.5
Penalties 
Penalty for late submission is 5% per day (1 mark per day) enter negative number 
Compilation errors and other penalties, enter negative number 

Get COIT 20245 Introduction to Programming Assignment Help with Punjab Assignment Help for just $95 AUD now !! with 100% plagiarism-free.