Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

By java language : write code to solve assignment Objectives Learn to use and implement multidimensional array. Performing procedure on array elements. Learn to use

By java language : write code to solve 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.

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

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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 doesn't 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. Create a Single Dimension Array to store customers name (See Table 1), and create a method that read all names of customers from given input.txt file and stored customer name in an array. Table 1. Customers information Customer Name Jawad_Ali Saif Abdulraheem Fatima_Mohamed Nada_Ali // array of type String for the customer name Create a Single Dimension Array to store Item names (See Table 2), and create a method that read all Items names from given input.txt file and stored Item name in an array. Table 2. Item Names information Item name Pen Pencil Book Keyboard Mouse Watch Toys Shoe Sunglass Perfume // array 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 480.0 8900.0 750.0 // array of type double for the Item 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 invoice to Rook:230 how Many (Quantity) Item Index 2 index customer o Jawad Ali Saif Abdulraheem 2 Fatima Mohamed Invoice[1] how Many Quantity) 3 Nada_Ali Item Index Perfume 6 10 85 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 Ali Fatima_Mohamed Saif Abdulraheem Jawad Ali Invoice[3] invoice[2] invoice[1] invoice[0] Figure 1 The structure of the 3D 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.txt] add_Invoice 0 22 8 4 5 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 7 1 10 2 20 3 15 4 10 6 10 7 15 8 5 In above line add_Invoice is a command and First number (2) means third custome 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.txt/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] 1/ 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.txt] // 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 10000] // 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. // Method to generate Invoices of each customer with complete details of the items purchased, how many, total, grand total etc about App Your program shall automatically save information about you as per given hint([Your Full Name], write your full name), etc. in the output file. Make sure to generate exact information, only replace it with your record. (see print.bct + Quit-This option will be used to Exit from the System. Output File Pattern The output file should include all the results of the commands that have been read from the input file [input.txt]. Your program must generate output in a similar format to the given sample output file [print.txt). All report are formatted save as per given sample output. Deliverable You have to submit only the java file of your code. The file and the class name should be "P1_Section_Your FirstName_YourID". Where Section is your class section. Your FirstName is your first name. You ID is your university ID. For example Pl_IT_Ahmad 199090. Important Notes: Your Code, output, results etc. must be in a readable form. Organize your code in separate methods. Repeat the program until Quit command is read by your program. Use comments in your code. Use meaningful variables. Use dash lines separator between each method. 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 doesn't 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. Create a Single Dimension Array to store customers name (See Table 1), and create a method that read all names of customers from given input.txt file and stored customer name in an array. Table 1. Customers information Customer Name Jawad_Ali Saif Abdulraheem Fatima_Mohamed Nada_Ali // array of type String for the customer name Create a Single Dimension Array to store Item names (See Table 2), and create a method that read all Items names from given input.txt file and stored Item name in an array. Table 2. Item Names information Item name Pen Pencil Book Keyboard Mouse Watch Toys Shoe Sunglass Perfume // array 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 480.0 8900.0 750.0 // array of type double for the Item 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 invoice to Rook:230 how Many (Quantity) Item Index 2 index customer o Jawad Ali Saif Abdulraheem 2 Fatima Mohamed Invoice[1] how Many Quantity) 3 Nada_Ali Item Index Perfume 6 10 85 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 Ali Fatima_Mohamed Saif Abdulraheem Jawad Ali Invoice[3] invoice[2] invoice[1] invoice[0] Figure 1 The structure of the 3D 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.txt] add_Invoice 0 22 8 4 5 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 7 1 10 2 20 3 15 4 10 6 10 7 15 8 5 In above line add_Invoice is a command and First number (2) means third custome 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.txt/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] 1/ 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.txt] // 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 10000] // 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. // Method to generate Invoices of each customer with complete details of the items purchased, how many, total, grand total etc about App Your program shall automatically save information about you as per given hint([Your Full Name], write your full name), etc. in the output file. Make sure to generate exact information, only replace it with your record. (see print.bct + Quit-This option will be used to Exit from the System. Output File Pattern The output file should include all the results of the commands that have been read from the input file [input.txt]. Your program must generate output in a similar format to the given sample output file [print.txt). All report are formatted save as per given sample output. Deliverable You have to submit only the java file of your code. The file and the class name should be "P1_Section_Your FirstName_YourID". Where Section is your class section. Your FirstName is your first name. You ID is your university ID. For example Pl_IT_Ahmad 199090. Important Notes: Your Code, output, results etc. must be in a readable form. Organize your code in separate methods. Repeat the program until Quit command is read by your program. Use comments in your code. Use meaningful variables. Use dash lines separator between each method

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

Why do mergers and acquisitions have such an impact on employees?

Answered: 1 week ago

Question

2. Describe the functions of communication

Answered: 1 week ago