ant note: your code must compile correctly and run without errors. Otherwise, your code will get the grade zero.   Question 1: Implement a java class called ParsingCustomerRecords that has the following data members and functions:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Important note: your code must compile correctly and run without errors. Otherwise, your code will get the grade zero.

 

Question 1: Implement a java class called ParsingCustomerRecords that has the following data members and functions:

 

 

ParsingCustomerRecods

- customerRecords: array of strings

result: string variable

recordsNumber: int variable

-fileName: string variable

+ Constructor(String filename, int recordsNumber)

+ void Reader()

+ void Executor()

+ void showResult()

+ String toString()

 

All of the data members are private, and all of the methods are public.

 

Constructor has two parameters which are (1) the file name in which Customers’ records are stored, and (2) the number of the records in the file. The constructor functionality is to assign suitable initial values to the fileName and recordsNumber data members. The constructor also should instantiate the customerRecords array, where the size of the array should be equal to recordsNumber.

 

Reader is a void method that reads the Customers’ records file line by line and stores each record (i.e., each line) at distinct index in the customerRecords array.

 

Executor is a void method that goes over all the records at customerRecords array and executes each record as explained below:

 

  • Each record has the format: Customer full name, Customer-id, followed by 3 integer values that represent the detailed bill for the customer. As shown in the following example: Ahmed Hesham, K15, 100,70,10

 

  • For each record, the Executor function reads the Customer full name, id, then reads the three integer values and computes their summation, and accumulates the results (i.e., the Customer full name, id, and the summation value) in the result data

 

showResult is a void method that shows the result of records execution (which is stored in the result data member) to the user using JOptionPane message.

 

toString is a method that returns the String "The customer informtation is: " + the string that is stored in result. Note: + means string concatenation.

 

In the main:

  1. Read the records file name from user using JOptionPane input dialog. Give the file this name: txt
  2. Read the records number from user using JOptionPane input dialog
  3. Create and instantiate an object of ParsingCustomerRecords Pass the filename and records number to the constructor.
  4. Call Reader method
  5. Call Executor method
  6. Call showResult method
  7. Print the object that was created in step 2 (using a System.out.println statement).
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education