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

  1. The minimum and maximum original prices which can be stored are  and . 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  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  and greater than  then an appropriate message should be displayed and the user should be asked to enter a new price.

 

  1. 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.

 

  1. Display all ISBN numbers which have over original price

This option displays all book titles stored in Array/ArrayList which have over  original price. If there are no books with over $100 then an appropriate message should be displayed.

 

  1. 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.

 

  1. 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.

 

  1. 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.

 

  1. 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.

 

  1. 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

Related posts: