C++ Exercise 1 Part 1 Hewlard packers have heard good things about your recent work for Easons and they want to offer yo

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

C++ Exercise 1 Part 1 Hewlard packers have heard good things about your recent work for Easons and they want to offer yo

Post by answerhappygod »

C Exercise 1 Part 1 Hewlard Packers Have Heard Good Things About Your Recent Work For Easons And They Want To Offer Yo 1
C Exercise 1 Part 1 Hewlard Packers Have Heard Good Things About Your Recent Work For Easons And They Want To Offer Yo 1 (182.5 KiB) Viewed 19 times
C++ Exercise 1 Part 1 Hewlard packers have heard good things about your recent work for Easons and they want to offer you a job to help them solve a problem they are having with their tax bill. They want you to develop some software to calculate their total tax bill owed to the tax man every month. HP sell two type of sales product; (i) printers and (ii) a repair service. Both of these sales products have a unique ID to identify the transaction. They both have a date of sale as well as a price. VAT for the printer is 23% while VAT is charged at 13% for the repair service. If a tax bill is later that 28 days from the sales date the tax man demands 2% compound interest on the initial tax bill for every 28 days. Use inheritance to create the two types of sales products and create a number of objects of both types in your main function. Be sure to give all classes appropriate constructors, get and set values functions, as well as a print function to print out all the details. Demonstrate the functionality of your classes working in the main function. Write some code in your main function to calculate the total tax bill for all the sales items; you will need two for loops to do this assuming you have created two arrays; one for printer objects and one for repairs. Part 2 Now add some code to your solution from exercise 1 to demonstrate polymorphism. Create a number of pointers to the parent class, and set these equal to the addresses of some of the objects you created as part of the first exercise. Once again demonstrate the full functionality of your classes (as much as you can) this time using the parent class pointers and the arrow notation. Part 3 Now take your solution from exercise 2 and change it again. This time delete all lines where you created the original objects in exercise 1. Instead you are going to create these objects in the same line that you created the pointers as part of exercise 2. To do this write the line parent class type *pointer name = new child class type You might have noticed by now that when using the parent class pointers and arrow notation, you are not able to access functions that were defined in the child classes and were not available to the parent class. To solve this problem add a little bit of code to your parent class definition to convert it to an abstract base class; see notes. Hint: You will need to use the word virtual. Now demonstrate the full functionality of your classes using the arrow notation. Part 4 You are making great progress. Finally you need to create an array of parent class pointers and use these to point to your child class objects. Basically you need to begin with a line where you create whatever number of pointers you need to point to all of the objects that you are using. parent class type *array name[4] array name[0] = new child class type etc. etc. Finally use a single for loop to calculate the total tax bill.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply