Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

by java language . answer next assignment : Objectives Learn to use and implement multidimensional array. Performing procedure on array elements. Learn to use and

by java language . answer next assignment :

Objectives Learn to use and implement multidimensional array. Performing procedure on array elements. Learn to use and implement String, File I/O (Reading/Writing from/to files).

Delivery: Submit your assignment on the Blackboard ONLY. Make sure to add your name / IDs / Section / course name / Assignment number, as comment at the beginning of your program. Description: Invoicing System is a software (program) that shall be used to store different data like: Customer names. Item names and its prices. Items purchased by each customer

This software shall also generates invoices for each customer based on the items he/she purchased. Basic Requirements: The program shall read the data from a text file called input.txt that follows a specific pattern. If the file doesnt exist, print a message to let the user know what happened. see Input file for more details. The program shall generate a text file as the output called print.txt that contains the results of the commands written in the input file see print file for more details. The program shall load data dynamically from the given text file input.txt and user is not involved in data entry.

The Initial Procedure of the Program: You will use File I/O concepts to read given file [input.txt]. Make sure the file exist or display a message that the file does not exist. The file consists of: 2 integers to determine array size for customer names, item names, item prices [see input.txt file]:

The first number (4) in the file refers to the number of customers to be stored in the System [means, system shall accept ONLY FOUR customers name. The second number (10) refers to the number of Items name to be stored in the system [ means system shall accept ONLY 10 Items name] Note: Item prices shall be of same size as of item names.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Toys Shee Sunglass Perfume Alany of type String for the Item names Create a Single Dimension Array to store Item prices (See Table 3), and create a method that read all items prices from given input.txt file and stored Item price in an array. Table 3. Item prices' information Item prices 10.0 5.0 230.0 450.0 330.0 950.0 73.5 900.0 750.0 Ilary of type double for the the prices Create a 3-Dimentional array to store items purchased and how many such purchased by each customers as shown (See Table 6). Table 4. Customer purchase record stored in 3 Dimension Array Item Index how Many Quantity Quantity The 3- Dimensional array virtually link customer, Item and price arrays. Each customer has number of items he/she want to buy, so this 3 Dimensional array have different rows and columns based on the total items customer is buying, which of the items he/she purchased and how many of them as shown in above table 4 and figure 1 illustrates the structure of the 3D array. Nada All Fatima Mohamed Saif Abdulraheem lawad AB invoice invoice[2] invoice 11 no! Figure 1 The structure of the 3D array // Three Dimensional Array Note All Commands must be implemented using separate methods. The commands you will have to implement are as follows: add cutomer-Your program shall read customer names and store in an array to be used in the system. (see input.txt] add_cutomer Jawad Ali Saif Abdulraheem ... In above line add_cutomer is a command and Jawad_Ali, Saif Abdulraheem etc. are customer names. // Method to do above task add ItemName - Your program shall read Items names and store in an array to be used in the system. (see input.txt] add ItemName Pen Pencil Book ... In above line add_ItemName is a command and Pen, Pencil, Book etc. are name of items. // Method to do above task add ItemPrice - Your program shall read Items prices and store in an array to be used in the system. see input.txt] add_ItemPrice 10.0 5.0 230.0 In above line add ItemPrice is a command and 10.0, 5.0, 230 are prices of items Pen, Pencil, Books etc. respectively. // Method to do above task add_Invoice- Your program shall read how many items purchased by customer, create a structure to store the index of item he/she purchased and how many such items purchased. see input.bxt] add_Invoice 0 228 45 In above line add Invoice is a command and First number (0) means first customer Second number (2) means he/she purchased two items. Third number (2) means he purchased item with index 2, which is book Fourth number (8) means he purchased 8 items with index 2 which is Book in our system Fifth number (4) means he purchased item with index 4, which is Mouse. Sixth number (5) means he purchased 5 items with index 4 which is Mouse in our system Similarly add_Invoice 2 71 10 2 20 3 15 4 10 6 10 7 1585 In above line add Invoice is a command and First number (2) means third customer Second number (7) means he/she purchased seven items. Third number (1) means he purchased item with index 1, which is Pencil Fourth number (10) means he purchased 10 items with index 1 which is Pencil in our system. Fifth number (2) means he purchased item with index 2, which is Book Sixth number (20) means he purchased 20 items with index 2 which is book in our system Fifth number (3) means he purchased item with index 3 which is Keyboard Sixth number (15) means he purchased 15 items with index 3 which is Keyboard in our system. Fifth number (4) means he purchased item with index 4, which is Mouse Sixth number (10) means he purchased 10 items with index 4 which is Mouse in our system. Fifth number (6) means he purchased item with index 6, which is Toys Sixth number (10) means he purchased 10 items with index 6 which is Toys in our system. Fifth number (7) means he purchased item with index 7, which is Shoe Sixth number (15) means he purchased 15 items with index 7 which is Shoe in our system Fifth number (8) means he purchased item with index 8, which is Sunglass Sixth number (5) means he purchased 5 items with index 8 which is Suglass in our system. Note: You have to add the items purchased details for each customer as per above explanation. (see input.bxt / Table 4) and Think] // Method to do above task print_Item_details. Your program shall automatically generate report based on Total Items available in the system and save in the output file. (see print.txt] // Method to Print Item detail in the output file. search Item Watch-Your program shall automatically Search the item based on name in the system and save in the output file. (see print.xt] // Method to search the item and its detail in the output file. In above line search_Item is a command and Watch is the item you are searching in the system. Make sure to display exact message in the output file if record found or not found. (see print.txt] print All Invoices Your program shall automatically generate Invoices for all the customer with detailed report like items purchased along sub-total and grand total of the invoice. This shall also generate a unique invoice number for each invoice and save in the output file. Make sure to generate exact invoice as given see print.txt] // Method to generate invoice number. (start with JED + any Radom number in range of 100001 // Method to generate name of customer as per given sample output. (remove) Note: You shall create a supporting method String textSplit(String text) to return a text by removing char from the given text. For example given text to the method is lawad Ali and the method return Jawad Ali. Toys Shee Sunglass Perfume Alany of type String for the Item names Create a Single Dimension Array to store Item prices (See Table 3), and create a method that read all items prices from given input.txt file and stored Item price in an array. Table 3. Item prices' information Item prices 10.0 5.0 230.0 450.0 330.0 950.0 73.5 900.0 750.0 Ilary of type double for the the prices Create a 3-Dimentional array to store items purchased and how many such purchased by each customers as shown (See Table 6). Table 4. Customer purchase record stored in 3 Dimension Array Item Index how Many Quantity Quantity The 3- Dimensional array virtually link customer, Item and price arrays. Each customer has number of items he/she want to buy, so this 3 Dimensional array have different rows and columns based on the total items customer is buying, which of the items he/she purchased and how many of them as shown in above table 4 and figure 1 illustrates the structure of the 3D array. Nada All Fatima Mohamed Saif Abdulraheem lawad AB invoice invoice[2] invoice 11 no! Figure 1 The structure of the 3D array // Three Dimensional Array Note All Commands must be implemented using separate methods. The commands you will have to implement are as follows: add cutomer-Your program shall read customer names and store in an array to be used in the system. (see input.txt] add_cutomer Jawad Ali Saif Abdulraheem ... In above line add_cutomer is a command and Jawad_Ali, Saif Abdulraheem etc. are customer names. // Method to do above task add ItemName - Your program shall read Items names and store in an array to be used in the system. (see input.txt] add ItemName Pen Pencil Book ... In above line add_ItemName is a command and Pen, Pencil, Book etc. are name of items. // Method to do above task add ItemPrice - Your program shall read Items prices and store in an array to be used in the system. see input.txt] add_ItemPrice 10.0 5.0 230.0 In above line add ItemPrice is a command and 10.0, 5.0, 230 are prices of items Pen, Pencil, Books etc. respectively. // Method to do above task add_Invoice- Your program shall read how many items purchased by customer, create a structure to store the index of item he/she purchased and how many such items purchased. see input.bxt] add_Invoice 0 228 45 In above line add Invoice is a command and First number (0) means first customer Second number (2) means he/she purchased two items. Third number (2) means he purchased item with index 2, which is book Fourth number (8) means he purchased 8 items with index 2 which is Book in our system Fifth number (4) means he purchased item with index 4, which is Mouse. Sixth number (5) means he purchased 5 items with index 4 which is Mouse in our system Similarly add_Invoice 2 71 10 2 20 3 15 4 10 6 10 7 1585 In above line add Invoice is a command and First number (2) means third customer Second number (7) means he/she purchased seven items. Third number (1) means he purchased item with index 1, which is Pencil Fourth number (10) means he purchased 10 items with index 1 which is Pencil in our system. Fifth number (2) means he purchased item with index 2, which is Book Sixth number (20) means he purchased 20 items with index 2 which is book in our system Fifth number (3) means he purchased item with index 3 which is Keyboard Sixth number (15) means he purchased 15 items with index 3 which is Keyboard in our system. Fifth number (4) means he purchased item with index 4, which is Mouse Sixth number (10) means he purchased 10 items with index 4 which is Mouse in our system. Fifth number (6) means he purchased item with index 6, which is Toys Sixth number (10) means he purchased 10 items with index 6 which is Toys in our system. Fifth number (7) means he purchased item with index 7, which is Shoe Sixth number (15) means he purchased 15 items with index 7 which is Shoe in our system Fifth number (8) means he purchased item with index 8, which is Sunglass Sixth number (5) means he purchased 5 items with index 8 which is Suglass in our system. Note: You have to add the items purchased details for each customer as per above explanation. (see input.bxt / Table 4) and Think] // Method to do above task print_Item_details. Your program shall automatically generate report based on Total Items available in the system and save in the output file. (see print.txt] // Method to Print Item detail in the output file. search Item Watch-Your program shall automatically Search the item based on name in the system and save in the output file. (see print.xt] // Method to search the item and its detail in the output file. In above line search_Item is a command and Watch is the item you are searching in the system. Make sure to display exact message in the output file if record found or not found. (see print.txt] print All Invoices Your program shall automatically generate Invoices for all the customer with detailed report like items purchased along sub-total and grand total of the invoice. This shall also generate a unique invoice number for each invoice and save in the output file. Make sure to generate exact invoice as given see print.txt] // Method to generate invoice number. (start with JED + any Radom number in range of 100001 // Method to generate name of customer as per given sample output. (remove) Note: You shall create a supporting method String textSplit(String text) to return a text by removing char from the given text. For example given text to the method is lawad Ali and the method return Jawad Ali

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

What is sampling for attributes?

Answered: 1 week ago