Ebenezer Obasi

~ Web Dev & Designer ~

Simple Paypal Fee Calculator with C++
Posted On Wednesday, May 13, 2015

Here is a simple C++ program that will output how much you get when you charge certain amount on Paypal and how much you should charge to get a particular amount.

Program Details


This program was written with Code Block IDE/compiler. Paypal charges 2.2% + $0.30 of every payment you receive.

/* Project: PayPal Fee calculator Developer: Ebenezer Obasi Website: www.eobasi.com */ #include <iostream> #include<iomanip> using namespace std; float rate( float r){ r = 0.029 * r + 0.30; // 2.9% * Your Amount + Additional $0.30 return r; } int main() { float amount, paypal, am, charg, charge, charger; cout << "Enter amount: $"; cin >> amount; am = amount - rate(amount); paypal = rate(am); charg = am + paypal + 0.30; charge = charg - rate(charg); charger = amount + rate(charg); cout << fixed << setprecision(2) << "You will get: $" << am <<endl; cout << fixed << setprecision(2) << "PayPal takes: $" << paypal <<endl; cout << "--------------------------------------------" <<endl; cout << fixed << setprecision(2) << "If you charge: $" << charg <<endl; cout << fixed << setprecision(2) << "You will get: $" << charge <<endl; cout << fixed << setprecision(2) << "Paypal takes: $" << rate(charg) <<endl; cout << "--------------------------------------------" <<endl; cout << fixed << setprecision(2) << "You should charge: $" << charger <<endl; cout << fixed << setprecision(2) << "Paypal takes: $" << rate(charg) <<endl; return 0; }


To get this running on your visual studio, simply include the following line in your pre-processor directive:

#include "stdafx.h"
Have fun!

Email Newsletter

Like what you read here in this blog post?
Get more like it delivered to your inbox daily.


Contact Form

Name

Email *

Message *