Problem: A company is a legal entity formed by a group of individuals to engage in and operate a business enterprise. A company may be organized in various ways for tax and financial liability purposes depending on the corporate law of its jurisdiction. Businesses can be for-profit entities or they can be non-profit organizations that operate to fulfil a charitable mission or further a social cause. You are requested to develop an OOP solution that computes a company and/or business tax payments based on company’s income and business’ profit. Create a NetBeans project named “LabTest_YourId”. Include the following interfaces and classes: - Interface Tax that includes two parameter-less methods: o getEarningAmount: should return a double value. o getTax: also return a double value presenting percentage of tax to be paid. - Class Company: o A company has a name, registration address, income and tax percentage. o Include a constructor that receives a company information as parameters and use it to set the company object data. o The class should implement the Tax interface, as follows:  It returns the income as the earning amount.  It returns the tax percentage of a company. o Override toString( ) method to describe company object as follow: “company name [ registration address ]” . o No further mutator (set) or accessor (get) methods are requested for this class. - Class Business: o A business object has an owner name, profit, and tax percentage. o Include a constructor that receives a business information as parameters and use it to set a business object. o Class business should implement the Tax interface, as follows:  It returns the business profit as the earning amount.  It returns the tax percentage to be paid by this business. o Implement get method to retrieve the business’ owner name. o Do not apply mutator methods. Page 2 of 4 - Class TaxDemo: o This is a tester program to test the above classes. It should have below methods:  The calculateTax method: that accepts an amount and tax-percent x% and returns x% of the amount.  The display static method: to print the output as shown in the sample run below (Figure 2), this method calls calculateTax to obtain tax amount for each Company/ Business object.  The main method: - Sample run1:  Asks user for input file name.  Reads objects of type Company and/or Business from the input file into two separate ArrayLists. Where the line for a company object information starts with “c” or “C” and for a business object starts with “b” or “B”. Any other character means invalid line. See Figure 3 for a sample input file, “dataA.txt”, which is also available on Moodle.  Your code should catch and handle FileNotFoundException; see Figure 1.  For any invalid line, display an error message “Bad data Error: Invalid Type!” with line number that caused the error. See sample output runs in Figure 2.  After reading the whole input file, it calls display method to print the output as shown in Figure2.

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
Problem: A company is a legal entity formed by a group of individuals to engage in and operate a business enterprise. A company may be organized in various ways for tax and financial liability purposes depending on the corporate law of its jurisdiction. Businesses can be for-profit entities or they can be non-profit organizations that operate to fulfil a charitable mission or further a social cause. You are requested to develop an OOP solution that computes a company and/or business tax payments based on company’s income and business’ profit. Create a NetBeans project named “LabTest_YourId”. Include the following interfaces and classes: - Interface Tax that includes two parameter-less methods: o getEarningAmount: should return a double value. o getTax: also return a double value presenting percentage of tax to be paid. - Class Company: o A company has a name, registration address, income and tax percentage. o Include a constructor that receives a company information as parameters and use it to set the company object data. o The class should implement the Tax interface, as follows:  It returns the income as the earning amount.  It returns the tax percentage of a company. o Override toString( ) method to describe company object as follow: “company name [ registration address ]” . o No further mutator (set) or accessor (get) methods are requested for this class. - Class Business: o A business object has an owner name, profit, and tax percentage. o Include a constructor that receives a business information as parameters and use it to set a business object. o Class business should implement the Tax interface, as follows:  It returns the business profit as the earning amount.  It returns the tax percentage to be paid by this business. o Implement get method to retrieve the business’ owner name. o Do not apply mutator methods. Page 2 of 4 - Class TaxDemo: o This is a tester program to test the above classes. It should have below methods:  The calculateTax method: that accepts an amount and tax-percent x% and returns x% of the amount.  The display static method: to print the output as shown in the sample run below (Figure 2), this method calls calculateTax to obtain tax amount for each Company/ Business object.  The main method: - Sample run1:  Asks user for input file name.  Reads objects of type Company and/or Business from the input file into two separate ArrayLists. Where the line for a company object information starts with “c” or “C” and for a business object starts with “b” or “B”. Any other character means invalid line. See Figure 3 for a sample input file, “dataA.txt”, which is also available on Moodle.  Your code should catch and handle FileNotFoundException; see Figure 1.  For any invalid line, display an error message “Bad data Error: Invalid Type!” with line number that caused the error. See sample output runs in Figure 2.  After reading the whole input file, it calls display method to print the output as shown in Figure2.
LAB TEST OUTPUT A
Alter reading the whole input file, it calls display method to print the output as shown in Figurez.
Sample runl:
run:
Enter file name: mydata
Lab Test Error: input file not found
BUILD SUCCESSFUL (total time: 8 seconds)
Figure I FileNotFoundException is caught
Page 3 of 4
Sample run2:
run:
Enter file name: dataA.txt
Bad data Error: Invalid type! Line: 4
Bad data Error: Invalid type! Line: 10
Companies:
BIC Contracting(SO125345]
Tax Paid
18600.00
Omran (NC001306]
Sohar Aluminium[S0965869]
Midis Group (NI369996]
Voltas Limited[OC639685]
27040.00
171.43
21300.00
288.11
Businesses:
Mesh
Getsocio
Freshbooks
Oberlo
Tax Paid
313.78
327.89
866.73
550.10
BUILD SUCCESSFUL (total time: 5 seconds)
Figure 2 Sample Output for input file "dataA.txr"
Sample input "data.txt":
F te fem
c:BIC Contracting:S0125345: 120000: 15.5
c: Omran:NCO01306:13520e:20
b:Mesh : 8965: 3.5
s:Sindibad:NQ263586: 3.99
C:Sohar Aluminium:S0965869: 1360.585 :12.6
C:Midis Group:NI369996: 150000 :14.2
b:Getsocio : 5288.5 : 6.2
C:Voltas Limited:0C639685: 3693.78 :7.8
B:Freshbooks : 6989.75 : 12.4
f:Wordlab : 9999 : 9.6
B:Oberlo : 5500.99 : 10.0
Figure 3 input file "dataA.txr"
Transcribed Image Text:LAB TEST OUTPUT A Alter reading the whole input file, it calls display method to print the output as shown in Figurez. Sample runl: run: Enter file name: mydata Lab Test Error: input file not found BUILD SUCCESSFUL (total time: 8 seconds) Figure I FileNotFoundException is caught Page 3 of 4 Sample run2: run: Enter file name: dataA.txt Bad data Error: Invalid type! Line: 4 Bad data Error: Invalid type! Line: 10 Companies: BIC Contracting(SO125345] Tax Paid 18600.00 Omran (NC001306] Sohar Aluminium[S0965869] Midis Group (NI369996] Voltas Limited[OC639685] 27040.00 171.43 21300.00 288.11 Businesses: Mesh Getsocio Freshbooks Oberlo Tax Paid 313.78 327.89 866.73 550.10 BUILD SUCCESSFUL (total time: 5 seconds) Figure 2 Sample Output for input file "dataA.txr" Sample input "data.txt": F te fem c:BIC Contracting:S0125345: 120000: 15.5 c: Omran:NCO01306:13520e:20 b:Mesh : 8965: 3.5 s:Sindibad:NQ263586: 3.99 C:Sohar Aluminium:S0965869: 1360.585 :12.6 C:Midis Group:NI369996: 150000 :14.2 b:Getsocio : 5288.5 : 6.2 C:Voltas Limited:0C639685: 3693.78 :7.8 B:Freshbooks : 6989.75 : 12.4 f:Wordlab : 9999 : 9.6 B:Oberlo : 5500.99 : 10.0 Figure 3 input file "dataA.txr"
Expert Solution
steps

Step by step

Solved in 6 steps with 2 images

Blurred answer
Knowledge Booster
Software Development Approaches
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
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