Recent Question/Assignment
Assessment details for ALL students Assessment item 1— Java Console Application
Due date: Friday (26 Aug 16) 11:45 PM AEST ASSESSMENT
Weighting: 20%
Length: NA 1
Objectives
This assessment item is designed to test your understanding of objects, classes, types, operators, standard input/output, loops, if statements and methods.
Assessment task
Write a java console application that calculates and displays the cost of computing infrastructure setup for N banks. N should be declared as a constant and it should be equal to the largest digit of your student ID number (e.g. if your ID number is S547221 then N should be equal to 7 and you can declare it as final int N=7). The cost is based on number of computers to be installed as shown below in Table 1.
Table 1. Number of Computers and Cost
Number of Computers Cost
2 or less $1000
Over 2 but not more than 20 $1000 + $400 per computer Over 2
Over 20 but not more than 100 $1000 + $300 per computer Over 2
Over 100 $200 per computer
The application should ask the user to enter the number of computers for each bank (total N banks) and calculate the cost. The application should display the cost for each bank as shown in the example below. At the end of the Nth bank’s cost, a receipt with total cost, lowest cost and average cost should be displayed. The total cost is calculated by adding the setup cost for all banks. The lowest cost is calculated by finding the lowest amount from costs for N banks. The average cost is calculated by dividing the total cost with the total number of banks. The format for your input and output must be same as given in example below.
Example for N=4 (Note that a loop should be used for reading the input and displaying the output) Your welcome message should be here
Enter the number of computers for Bank number 1: 1
The cost to setup the computing infrastructure for Bank number 1 is $1000
Enter the number of computers for Bank number 2: 10
The cost to setup the computing infrastructure for Bank number 2 is $4200
Enter the number of computers for Bank number 3: 22
The cost to setup the computing infrastructure for Bank number 3 is $7000
Enter the number of computers for Bank number 4: 100
The cost to setup the computing infrastructure for Bank number 4 is $20000
*********Receipt for Total Cost, Lowest Cost and Average Cost*********
Total Cost is $32200 Lowest Cost is $1000 Average Cost is $8050
Your exit/end message containing your ID number must be here.
The application should be user-friendly by displaying appropriate welcome message at the beginning and an exit message at the end. The application should use the following classes and methods.
public class Bank
{
//declare constants
//declare fields/variables
//declare constructor
//declare and define all methods including get and set methods
}
public class BankTest
{
public static void main(String[] args)
{
//create object
//read and store quantity of computers using a set method
//get the quantity of computers using a get method and calculate the cost
//print the output as shown in the example
}
}
What to submit
You should submit online the following files.
• Bank.java (this file contains class Bank)
• BankTest.java (this file contains class BankTest)
• Report.docx (this file contains a brief report that includes student name, student ID number, course name, course code and test results (screenshots/test cases with results to show that your application is correctly working)).
Assessment marking criteria
Total Marks – 20 Marks Allocated
1 Variables, constants and types
Declaring and using variables and constants 1
2 Objects and classes
Creating/declaring and using objects and classes 2
3 Loops
Using loops and conditions 1
4 If statements
Using if statements and conditions 1
5 Methods
Declaring and using main method 1
Declaring and using other methods 2
6 Inputs and Outputs
Reading and displaying data 1
Cost for each bank 1
Receipt for total cost, lowest cost and average cost 3
7 Overall logic and program
Program logic 1
Spacing and indentation conventions 1
Naming conventions 1
Comments 1
User-friendly (welcome and exit messages) 1
8 Report
Test results 1
Presentation (fonts, spaces, information, language) 1
9 Penalty
Penalty for submission of incorrect files including names and formats is 2 marks
Penalty for using things not covered in weeks 1-6 of this course is 3 marks
Penalty for late submission is 5%/day