Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 3 Implement a C++ program that helps to explain the syntax and use of data structures such as arrays and pointers. These data structures
Question 3 Implement a C++ program that helps to explain the syntax and use of data structures such as arrays and pointers. These data structures form part of the data members and constructors in a C++ class. (a) Cb) (C) Declare the data members of TaxRe side nt class as follows: (i) A char with size 30 representing the name of the resident e.g. \"John Lim". (ii) A double representing the total income of the resident per year e.g. 10000.50. (iii) An integer representing the number of reliefs that the resident could apply to reduce their tax chargeable. (iv) A dynamic location large enough to store all reliefs' amount based on the number of reliefs that the resident applied. The location is reference by a pointer inl' personalReliefs. (v) A static double representing the tax interest for the tax chargeable of 15% of the resident's total income. (6 marks) Implement an application using the CH- language in an object-oriented style. Constructors and destructor are used to initialise and remove objects in an object- oriented manner. You are asked to write the following constructors to initialise a TaxRes ident object and a destructor to remove it from memory. (i) A parameterised constructor. (6 marks) (ii) A destructor. (2 marks) Write a oaloulateTax function that returns how much the resident needs to pay for the tax chargeable. The formula for the calculation of tax chargeable: taxChargeable = (totalInoome total amount of personalReliefs) * taxInterest (5 marks) (d) Write a displayTaxDetails function shows the details of the resident and tax chargeable. Figure Q3(d) shows an example of the output. Resident Name: Mary Tan Breakdown of Tax Chargeable: Your total income is $20000.7 and your tax chargeable is $2610.11 Program ended with exit code: 0 Figure Q3(d): Example output of display Tax Details function (3 marks) (e) Write a main ( ) function to demonstrate how part (b), (c) and (d) are being used.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started