Question: Write a SelfPayKiosk class in c + + to support basic operations such as scan item, cancel transaction, checkout, and make payment. SelfPayKiosk.h declares the
Write a SelfPayKiosk class in c to support basic operations such as scan item, cancel transaction, checkout, and make payment. SelfPayKiosk.h declares the functions necessary to complete the exercise. SelfPayKiosk.cpp provides the function stubs. Follow each step to gradually complete all functions in SelfPayKiosk.cpp
Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress. main in main.cpp includes basic function calls. Add statements as functions are completed to support development mode testing.
Step In SelfPayKiosk.h declare private data members for number of customers served int total sales double and current amount due double Note the provided constant variable for sales tax of
Step pt Complete the constructor to initialize all data members to zero. Complete the accessor functions to return the number of customers served, total sales, and current amount due. Submit for grading to confirm test passes.
Step pts Complete the ScanItem function. Increase the amount due by parameter price. Do not update amount due if parameter price is negative. Submit for grading to confirm tests pass.
Step pt Complete the CheckOut function. Multiply amount due by SALESTAX and add to amount due. Submit for grading to confirm tests pass.
Step pts Complete the MakePayment function. If parameter payment is enough to pay the amount due, increase total sales by amount due, increment number of customers served, and reset amount due to zero in preparation for the next customer. However, if parameter payment is not enough, update total sales by payment and reduce amount due by payment. Do not make any changes if parameter payment is negative. Submit for grading to confirm tests pass.
Step pt Complete the ResetKiosk function to reset all data members to zero. Complete the CancelTransaction function to reset amount due to zero. Submit for grading to confirm tests pass.
Step pts Complete the SimulateSales function to perform multiple transactions with increasing prices. Use a loop to simulate parameter numSales transactions. Within the loop, call ScanItem with parameter initialPrice. Call CheckOut and MakePayment to make a payment of $ more than the amount due. Finally, increase the item price by parameter incrPrice in preparation for the next transaction. Submit for grading to confirm tests pass.
Step pt Add a boolean data member to indicate if the customer has checked out and is ready to make a payment. Only allow payment after customer has checked out. The CancelTransaction function should not reset amount due if the customer has checked out. Update the following function by inserting assignment statements and if statements related to the new data member: constructor, CheckOut MakePayment and CancelTransaction Ex: Set the boolean data member to false only after full payment has been made. Submit for grading to confirm all tests pass.
main.cpp
SelfPayKiosk.h
SelfPayKiosk.cpp
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
