CIS 278 Programming Project #4 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (2 votes)

You are to write a program which keeps track of one Customer’s credit card information. You will code a Customer class to describe credit data and actions.

Customer class

The following UML diagram describes members of this class:

Customer
– accountNo: int
– VIP:bool
– creditLimit:double // max credit available
– balance:double // current balance – new customer balance is 0.0
+ Customer( )
+ Customer( int num, double creditLim= 500.00)
+ Customer(int id, double initBal, bool newvip = true, double creditLiim= 500.00)
+void setAcct(int aNo)
+void setCredit( double amount) //precondition amount is positive
+int getAcctNo () const
+bool getVIP() const
+double getCreditLimit() const
+ double getBal( ) const
+double availCredit() const
+ void moreCredit(double amnt) // precondition – amount is positive
+ bool makePurchase(double amount) // precondition – amount is positive
+ void display(ostream& out) const
+ void makePayment(double amount) // precondition – amount is positive

The constructors are overloaded, so that an application which is creating a Customer object can do so without all info initially available. Any constructor which does is not provided with all data must use default values for the missing data. Defaults which can be used:
Account number => -1
Credit limit => 0.00
VIP => false
Balance => 0.0

The set and get functions perform as standard mutator/accessors.

The availCredit function returns the amount of credit available to the customer. For example, if the customers credit limit was $10 , and their balance is $8, the available credit is $2.

The moreCredit function takes one parameter, the amount of the increase in the customer’s credit limit.

The makePurchase function checks if the customer has enough available credit to cover the purchase amount. If there is enough available credit, the purchase is added to the customer balance, and true is returned. VIP customers are given a $100 pad – that is, they may go over their limit by $100. When a VIP customer charges over their limit their VIP status is changed to false If it is not possible to make the purchase then false is returned, to indicate that the purchase was not approved.

The makePayment function takes one parameter, the amount that is applied to the customer’s balance. If the balance becomes negative (the customer has overpaid) the customer becomes a VIP customer.

The ‘display’ function takes one parameter, an ostream object, such as ‘cout’. It outputs all the object’s data to that object.

The Application

Your application should:
• create a Customer object– (although you will only be using one constructor here, be sure and test all three)
• Display the Customer’s info using the ‘get’ functions
• Allow the user to choose/perform any of the following actions until he/she wishes to exit:
Make a purchase
Make a payment
Display the customer’s current credit limit
Display the customer’s current available amount of credit
Output the current balance for the customer
Request more credit for the customer
Display the Customer’s info using the display function

Be sure to use this program to test a variety of scenerios with your Customer class — such as when a purchase is not permitted, and when a customer becomes a VIP.

Be sure your code is well commented. Each class function should be preceded by a comment indicating what that function does, what it returns, how it effects the object, if at all. The application should contain comments which indicate where the different tasks (above) are taking place. And make Sure your name is in your code.

For this assignment, you may use one file for all code, as demonstratred in your text. If you prefer to use 3 files Customer.h, Customer.cpp, and CustomerApp that is okay, however I will not require a separately compiled class until the next project. Submit your CustomerApp.cpp file as an email attachment .