Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need Code in c++. I will give you thumbs up. Please also send me screen shot o

ID: 3591153 • Letter: I

Question

I need Code in c++. I will give you thumbs up. Please also send me screen shot of outcome if possible. There are several things common to checking accounts, savings accounts and credit card accounts. There are also some differences. We can practice the knowledge of inheritance and polymorphism by implementing a Base class called Account and then inheriting it to derive the two types of accounts (Bank, CreditCard). Bank account is further inherited by a CheckingAccount, and a SavingsAccount. Some of the data and functions will need to be overridden by the class to customize/specialize the functions. Example Common data members for these classes are: number, accountName, accountBalance, Common methods: getAccountNumber, getAccountName, getAccountBalance Differences: CreditCard class will have limit and charge, while Bank account has credit and debit, Savings accounts have interestEarned, checking accounts may have monthlyFee. Overridden members: Credit card numbers format is different from bank accounts. Bank accounts have a routingNumber and accountNumber. Therefore the variable number in the base class needs to be virtual and overridden by derived classes All the common data members and methods will go in the base class. Anything that is expected to be overridden will be declared as virtual. Think of the above problem and then answering the following questions 1) Draw an inheritence diagram for Account, Bank, Checking, Savings and CreditCard classes. (submit hard copy in class) 2) Write all the interfaces only. (Submit header files through blackboard) 3) Implement exception handling in the credit card class: a) Exception when the user is exceeding their credit limit, handle by denying the purchase. b) Exception if the user tries to make a payment that exceeds the balance due, handle by denying the payment c)Exception when the payment argument passed to function makePayment are negative, handle by denying the payment

Explanation / Answer

3)  

package com.wepay.model;

import java.io.IOException;

import org.json.*;

import com.wepay.WePay;

import com.wepay.net.WePayResource;

import com.wepay.exception.WePayException;

import com.wepay.model.data.*;

public class CreditCard extends WePayResource {

protected Long creditCardId;

protected String state;

protected String creditCardName;

protected String userName;

protected String email;

protected Long createTime;

protected String inputSource;

protected String virtualTerminalMode;

protected String referenceId;

protected Integer expirationMonth;

protected Integer expirationYear;

protected String bin;

protected String lastFour;

protected String backingInstrumentName;

protected Boolean autoUpdate;

protected Long[] rbitIds;

public CreditCard(Long creditCardId) {

this.creditCardId = creditCardId;

}

public static CreditCard fetch(Long creditCardId, String accessToken) throws JSONException, IOException, WePayException {

HeaderData headerData = new HeaderData();

headerData.accessToken = accessToken;

return CreditCard.fetch(creditCardId, headerData);

}

public static CreditCard fetch(Long creditCardId, HeaderData headerData) throws JSONException, IOException, WePayException {

JSONObject params = new JSONObject();

params.put("credit_card_id", creditCardId);

params.put("client_id", WePay.clientId);

params.put("client_secret", WePay.clientSecret);

String response = request("/credit_card", params, headerData);

CreditCard cc = gson.fromJson(response, CreditCard.class);

return cc;

}

public static CreditCard modify(Long creditCardId, String accessToken, Boolean autoUpdate, String callbackUri) throws JSONException, IOException, WePayException {

HeaderData headerData = new HeaderData();

headerData.accessToken = accessToken;

return CreditCard.modify(creditCardId, headerData, autoUpdate, callbackUri);

}

public static CreditCard modify(Long creditCardId, HeaderData headerData, Boolean autoUpdate, String callbackUri) throws JSONException, IOException, WePayException {

JSONObject params = new JSONObject();

params.put("client_id", WePay.clientId);

params.put("client_secret", WePay.clientSecret);

params.put("credit_card_id", creditCardId);

if (autoUpdate != null) {

params.put("auto_update", autoUpdate);

}

if (callbackUri != null) {

params.put("callback_uri", callbackUri);

}

String response = request("/credit_card/modify", params, headerData);

CreditCard cc = gson.fromJson(response, CreditCard.class);

return cc;

}

public void authorize(String accessToken) throws JSONException, IOException, WePayException {

this.authorize(0L, accessToken);

}

public void authorize(Long account_id, String accessToken) throws JSONException, IOException, WePayException {

HeaderData headerData = new HeaderData();

headerData.accessToken = accessToken;

this.authorize(account_id, headerData);

}

public void authorize(Long account_id, HeaderData headerData) throws JSONException, IOException, WePayException {

JSONObject params = new JSONObject();

params.put("credit_card_id", this.creditCardId);

params.put("client_id", WePay.clientId);

params.put("client_secret", WePay.clientSecret);

if (account_id > 0) {

params.put("account_id", account_id);

}

request("/credit_card/authorize", params, headerData);

}

public static CreditCard[] find(CreditCardFindData findData, String accessToken) throws JSONException, IOException, WePayException {

HeaderData headerData = new HeaderData();

headerData.accessToken = accessToken;

return CreditCard.find(findData, headerData);

}

public static CreditCard[] find(CreditCardFindData findData, HeaderData headerData) throws JSONException, IOException, WePayException {

JSONObject params = new JSONObject();

params.put("client_id", WePay.clientId);

params.put("client_secret", WePay.clientSecret);

if (findData != null) {

if (findData.referenceId != null) params.put("reference_id", findData.referenceId);

if (findData.limit != null) params.put("limit", findData.limit);

if (findData.start != null) params.put("start", findData.start);

if (findData.sortOrder != null) params.put("sort_order", findData.sortOrder);

}

JSONArray results = new JSONArray(request("/credit_card/find", params, headerData));

CreditCard[] found = new CreditCard[results.length()];

for (int i = 0; i < found.length; i++) {

CreditCard cc = gson.fromJson(results.get(i).toString(), CreditCard.class);

found[i] = cc;

}

return found;

}

public void delete(String accessToken) throws JSONException, IOException, WePayException {

HeaderData headerData = new HeaderData();

headerData.accessToken = accessToken;

this.delete(headerData);

}

public void delete(HeaderData headerData) throws JSONException, IOException, WePayException {

JSONObject params = new JSONObject();

params.put("credit_card_id", this.creditCardId);

params.put("client_id", WePay.clientId);

params.put("client_secret", WePay.clientSecret);

request("/credit_card/delete", params, headerData);

}

public void enableRecurring(AddressData address, String accessToken) throws JSONException, IOException, WePayException {

HeaderData headerData = new HeaderData();

headerData.accessToken = accessToken;

this.enableRecurring(address, headerData);

}

public void enableRecurring(AddressData address, HeaderData headerData) throws JSONException, IOException, WePayException {

JSONObject params = new JSONObject();

params.put("credit_card_id", this.creditCardId);

params.put("client_id", WePay.clientId);

params.put("client_secret", WePay.clientSecret);

if (address != null) {

params.put("address", AddressData.buildUnifiedAddress(address));

}

request("/credit_card/enable_recurring", params, headerData);

}

public Long getCreditCardId() {

return creditCardId;

}

public String getCreditCardName() {

return creditCardName;

}

public String getState() {

return state;

}

public String getUserName() {

return userName;

}

public String getEmail() {

return email;

}

public long getCreateTime() {

return createTime;

}

public String getInputSource() {

return inputSource;

}

public String getVirtualTerminalMode() {

return virtualTerminalMode;

}

public String getReferenceId() {

return referenceId;

}

public Integer getExpirationMonth() {

return expirationMonth;

}

public Integer getExpirationYear() {

return expirationYear;

}

public String getLastFour() {

return lastFour;

}

public String getBin() {

return bin;

}

public String getBackingInstrumentName() {

return backingInstrumentName;

}

public Boolean getAutoUpdate() {

return autoUpdate;

}

public Long[] getRbitIds() {

return rbitIds;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote