Read validate and store account number and internet usage


Objectives

This assessment item is designed to test your understanding of arrays/arraylists, objects, classes, methods, sorting and searching.

Assessment task

Write a java application that allows the user to read, validate, store, display, sort and search the internet account number (integer number), usage (integer number) and cost (double number) for N customers. 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 S0234182 then N should be equal to 8 and you can declare it as final int N=8;). The account number, usage and cost must be stored in three separate single dimension Arrays/ArrayLists (index 0 for customer 1 and index N-1 for customer N). The minimum and maximum account numbers which can be stored are 1111 and 8888. The minimum and maximum internet usages which can be stored are 5 GB and 1000 GB. The internet account number and usage 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 account number and internet usage for N customers

2. Calculate, store and display the cost for all customers

3. Display all account numbers which have over 10 GB usage

4. Find and display the account number with the highest cost

5. Find and display the account number with the lowest usage

6. Sort and display the cost in ascending order

7. Search and display the accounts which have usage equal to the given usage

8. Exit from the application

1. Read, validate and store account number and internet usage for N customers This option reads account number and usage for all customers from the keyboard and stores them in two separate single dimension Arrays/ArrayLists. If the account number is less than 1111 and greater than 8888 then an appropriate message should be displayed and the user should be asked to enter a new account number.

Similarly if the usage is less than 5 GB and greater than 1000 GB then an appropriate message should be displayed and the user should be asked to enter a new usage.

2. Calculate, store and display the cost for all customers This option calculates the cost ($2 for 1 GB), stores in an Array/ArrayList and displays the account number, usage and cost as follows. Example: Account Number Usage Cost 2123 15 GB $30 3367 5 GB $10 1123 11 GB $22

3. Display all account numbers which have over 10 GB usage This option displays all account numbers stored in Array/ArrayList which have over 10 GB usage. If there are no customers with over 10GB usage then an appropriate message should be displayed. Example: Account Number Usage Cost 2123 15 GB $30 1123 11 GB $22

4. Find and display the account with the highest cost This option finds and displays the account number stored in Array/ArrayList which has the highest cost. Example: Account Number Usage Cost 2123 15 GB $30

5. Find and display the account number with the lowest usage This option finds and displays the account number stored in Array/ArrayList which has the lowest usage. If there is more than one account with the same usage (lowest usage) then it displays all of them. Example: Account Number Usage Cost 3367 5 GB $10

6. Sort and display the cost in ascending order This option sorts and displays the cost stored in Array/ArrayList for all customers in ascending order. You can use any sorting algorithm. A built-in sort algorithm for sorting is not allowed in this assignment. Example: Account Number Usage Cost 3367 5 GB $10 1123 11 GB $22 2123 15 GB $30

7. Search and display the accounts which have usage equal to the given usage This option searches Array/ArrayList and displays the accounts which have usage equal to the given usage. The application asks the user to enter the internet usage in GB using the keyboard and searches for it.

If the usage entered from the keyboard is found then the application displays account number, usage and cost 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 "Thank you for using this application" 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 account number and internet usage for N customers.

Calculate, store and display the cost for all customers, Display all account numbers which have over 10 GB usage, Find and display the account number with the highest cost, Find and display the account number with the lowest usage, Sort and display the cost in ascending order, Search and display the accounts which have usage equal to the given usage and Exit from 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 Account { //fields //get and set methods } public class AccountTest { Method to read, validate and store account number and internet usage for N customers Method to calculate, store and display the cost for all customers Method to display all account numbers which have over 10 GB usage Method to find and display the account number with highest cost Method to find and display the account number with lowest usage Method to sort and display the cost in ascending order Method to search and display the accounts which have usage equal to the given usage

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.

• Account.java (this file contains java code for class Account)

• AccountTest.java (this file contains java code for class AccountTest).

• 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 cost for all customers) 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.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Read validate and store account number and internet usage
Reference No:- TGS01114977

Now Priced at $60 (50% Discount)

Recommended (95%)

Rated (4.7/5)