Recent Question/Assignment

Assessment details for ALL students
Assessment item 2—Assignment 2
Due date: Assignment 2 Due Friday (30 Sep 16) 11:45 PM AEST ASSESSMENT
Weighting: 30%
Length: NA 2
Objectives
This assessment item is designed to test your understanding of arrays/arraylists, objects, classes, methods, sorting and searching.
Assessment task
Write a java console application that allows the user to read, validate, store, display, sort and search the title (String), ISBN (integer number), original price (double number) and discounted price (double number) for N books. 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 S0172341 then N should be equal to 7 and you can declare it as final int N=7;). The book title, ISBN, original price and discounted price must be stored in four separate single dimension Arrays/ArrayLists (index 0 for book 1 and index N-1 for book N). The minimum and maximum ISBN numbers which can be stored are 0 and 999999. The minimum and maximum original prices which can be stored are $10 and $200. The ISBN and original price must be entered from the keyboard and a validation for minimum and maximum values must be done.
Your application should display and execute a menu with the following options. A switch statement must be used to execute the following menu options.
1. Read, validate and store book title, ISBN and original price for N books
2. Calculate, store and display the discounted price (price after 10% discount) for all books
3. Display all ISBN numbers which have over $100 original price
4. Find and display the book title with the lowest original price
5. Find and display the ISBN number with the highest discounted price
6. Sort and display the book titles in ascending order
7. Search and display the accounts which have ISBN equal to the given ISBN
8. Exit from the application
1. Read, validate and store book title, ISBN and original price for N books
This option reads book title, ISBN and original price for all books from the keyboard and stores them in three separate single dimension Arrays/ArrayLists. If the ISBN number is less than 0 and greater than 999999 then an appropriate message should be displayed and the user should be asked to enter a new ISBN number. Similarly if the original price is less than $10 and greater than $200 then an appropriate message should be displayed and the user should be asked to enter a new price.
2. Calculate, store and display the discounted price (price after 10% discount) for all books This option calculates the price after 10% discount, stores in an Array/ArrayList and displays the book title, ISBN and discounted price.
3. Display all ISBN numbers which have over $100 original price
This option displays all book titles stored in Array/ArrayList which have over $100 original price. If there are no books with over $100 then an appropriate message should be displayed.
4. Find and display the book title with the lowest original price
This option finds and displays the book title stored in Array/ArrayList which has the lowest original price.
5. Find and display the ISBN number with the highest discounted price
This option finds and displays the ISBN stored in Array/ArrayList which has the highest discounted price. If there is more than one ISBN with the same discounted price then it displays all of them.
6. Sort and display the book titles in ascending order
This option sorts and displays the book titles stored in Array/ArrayList for all books in ascending order. You can use any sorting algorithm. A built-in sort algorithm for sorting is not allowed in this assignment.
7. Search and display the accounts which have ISBN equal to the given ISBN
This option searches Array/ArrayList and displays the accounts which have ISBN equal to the given ISBN. The application asks the user to enter the ISBN using the keyboard and searches for it. If the ISBN entered from the keyboard is found then the application displays book title, ISBN, original price and discounted price otherwise it displays an appropriate message. A built-in search algorithm for searching can be used in this assignment.
8. Exit from the application
The application should display the message “Thanks for using the program” and your student id number and then exit from the application.
The application should work in a loop to enable the user to Read, validate and store book title, ISBN and original price for N books, Calculate, store and display the discounted price (price after 10% discount) for all books, Display all ISBN numbers which have over $100 original price, Find and display the book title with the lowest original price, Find and display the ISBN number with the highest discounted price, Sort and display the book titles in ascending order, Search and display the accounts which have ISBN equal to the given ISBN and Exit from the application
Program design
You may use any design that meets the specification. However, a good design will adhere to the following guidelines: • be logically correct
• be easy to read and maintain
• be well-designed
• use a UML activity diagram
• use appropriate classes, methods and fields
Your design MUST use the classes and methods as listed below.
public class Book
{
//fields
//get and set methods
}
public class BookTest {
Method to read, validate and store book title, ISBN and original price for N books
Method to calculate, store and display the discounted price for all books
Method to display all ISBN numbers which have over $100 original price
Method to find and display the book title with the lowest original price
Method to find and display the ISBN number with the highest discounted price
Method to sort and display the book titles in ascending order
Method to search and display the accounts which have ISBN equal to the given ISBN
public static void main(String[] args)
{
}
}
You may add/use other methods, parameters, fields/variables, constants, etc. which you need to complete the application.
Testing
Testing is important. You should:
• List the different types of test cases.
• Display the results for each test case.
What to submit
You should submit online the following files.
• Book.java (this file contains java code for class Book)
• BookTest.java (this file contains java code for class BookTest).
• Report.docx (this file contains a brief report that includes student name, student ID, course name, course code, UML activity diagram for menu option 2 (calculate, store and display the discounted price for all books) and test results (screenshots/test cases with results to show that your application is correctly working)).
Warning: You must submit your own work and correct files. Please read the plagiarism policy.
Assessment 2 marking criteria
Total Marks – 30 Marks
Allocated
1 Design, logic and testing – 14
Code readability – appropriate use of comments, indentation and naming conventions 3
Declaring and using fields/variables and constants 2
Creating/declaring and using objects, methods and classes 3
Overall design and logic (structure, efficiency) 2
Validity of testing as evidenced by submitted test results 2
UML activity diagram for menu option 2 2
2 Compilation and execution - 14
(0 - if application doesn't run)
Welcome and exit messages 1
Input data validation and message 1
Read and store book title and original price for N books 1
Calculate, store and display the discounted price for all books 2
Display all ISBN numbers which have over $100 original price 1
Find and display the book title with the lowest original price 1
Find and display the ISBN number with the highest discounted price 1
Sort and display the book titles in ascending order (0 mark if built-in sort method is used) 2
Search and display the accounts which have ISBN equal to the given ISBN 2
Overall program execution (user friendly, input/output and display) 2
3 Report – 2
Presentation (fonts, spaces, information, language) 2
4 Penalty
Penalty for submission of incorrect files including names and formats is 2 marks -2
Penalty for using things not covered in weeks 1-11 of this course is 3 marks -3
Penalty for late submission is 5%/day -5%/day