Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- using namespace std;
- float numberofunits = 50;
- float numberofunitsfree = 0;
- float normalrent = 600;
- float increase = 40;
- float maint = 27;
- // I calculated this number out - assuming that all units are full - to give the while loop a jumping off point
- float profit = 28650;
- float prevprofit = 28650;
- int main()
- {
- if (profit == 0) {
- profit = (numberofunits * normalrent) - (numberofunits * maint);
- prevprofit = profit;
- }
- while (prevprofit <= profit) {
- prevprofit = profit;
- cout << "Number of Units Full: " << numberofunits << endl;
- cout << "Rent at current number of units: " << normalrent << endl;
- cout << "Profit: " << profit << endl;
- normalrent = (numberofunitsfree * 40);
- normalrent = normalrent + 600;
- profit = numberofunits * normalrent;
- profit = profit - (maint * numberofunits);
- numberofunits = numberofunits - 1;
- numberofunitsfree = numberofunitsfree + 1;
- }
- cout << endl;
- cout << endl;
- cout << "Most Efficient Business Model is: " << prevprofit << endl;
- cout << "Number of Units Full: " << numberofunits + 1 << endl;
- cout << "Rent at current number of units: " << normalrent - 40 << endl;
- cout << "Profit: " << prevprofit << endl;
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement