c++ – Monthly Cost for House Code – Output not coming out correctly

My output is returning 0 for the value for the costs and I am not sure why.

#include <iostream>
#include <iomanip>
#include <cmath>

#define TAXRATE 0.0125
#define UTILITIES 300.00
#define INSURANCE 550.00

using namespace std;

// Function Prototypes
void getInput(double& sellPrice, double& interestRate, int& numYears);
void calcAll(double sellPrice, double interestRate, int numYears, double downPayment, double downPaymentRate, double loanAmount, double mortgage, double propertyTax, double insurance, double total);
double calcDownPayment(double sellPrice, double downPaymentRate);
double calcLoanAmount(double sellPrice, double downPayment);
double calcMortgage(double loanAmount, double interestRate, int numYears);
void output(double sellPrice, double interestRate, int numYears, double downPayment, double loanAmount, double mortgage, double propertyTax, double insurance, double total);
int main() {
    
// Non-global memory constant
    const double downPaymentRate = 20.0;
    
// Declare variables
    int numYears;
    double sellPrice, interestRate, mortgage, total, propertyTax, insurance, loanTime, loanAmount, downPayment;
    
// Input the data from the user
    getInput(sellPrice, interestRate, numYears);
    
// Calculate monthly cost
    calcAll(sellPrice, interestRate, numYears, downPayment, downPaymentRate, loanAmount, mortgage, propertyTax, insurance, total);

// Output the cost
    output(sellPrice, interestRate, numYears, downPayment, loanAmount, mortgage, propertyTax, insurance, total);
    
    
    return 0;
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
              
void getInput(double& sellPrice, double& interestRate, int& numYears)
{
/* Pre: sellPrice - reference to the sell price of the house
        interestRate - reference to the rate of interest per compounding period
        numYears - reference to the number of years for the loan
   Post: nothing
   Purpose: Enter the data for sell price, interest rate, and duration of loan
*/
                  
    cout << "How much was the house sold for? ";
    cin >> sellPrice;
                  
    cout << "What is the interest rate? ";
    cin >> interestRate;
                  
    cout << "Enter the number of years for the loan: ";
    cin >> numYears;
                  
}

void calcAll(double sellPrice, double interestRate, int numYears, double downPayment, double downPaymentRate, double loanAmount, double mortgage, double propertyTax, double insurance, double total)
{
/* Pre: sellPrice - sell price of house
        interestRate - interest rate
        numYears - duration of loan
        downPayment - down payment for house
        downPaymentRate - down payment percentage cost for the house
        loanAmount - amount that is loaned to user
        mortgage - mortgage owed for house
        propertyTax - property taxe owed for house
        insurance - insurance owed for house
   Post: nothing
   Purpose: Calculate the amounts for each function
*/
    downPayment = calcDownPayment(sellPrice, downPaymentRate);
    
    loanAmount = calcLoanAmount(sellPrice, downPayment);
    
    mortgage = calcMortgage(loanAmount, interestRate, numYears);
    
    insurance = INSURANCE / 12.0;
    
    propertyTax = (sellPrice * TAXRATE) / 12.0;
    
    total = mortgage + UTILITIES + propertyTax + insurance;
}

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

double calcDownPayment(double sellPrice, double downPaymentRate)
{
/* Pre: sellPrice - sell price of house
        downPaymentRate - down payment percentage cost for the house
   Post: down payment amount
   Purpose: Calculate the down payment amount owed
*/
    double monthlyDownPayment;
    
    monthlyDownPayment = (sellPrice * downPaymentRate) / 12.0;
    
    return monthlyDownPayment;
}

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
              
double calcMortgage(double loanAmount, double interestRate, int numYears)
{
/* Pre: interestRate - rate of interest per compounding period
        numYears - number of years for the loan
        loanAmount - amount loaned for the house
        Post: mortgage cost
        Purpose: Calculate the mortgage cost
*/
                  
// Declare variables
    double loanTime = numYears * 12.0;
    double loan = loanAmount;
    double interest = (interestRate / 100.0) * 12.0;
    double mortgage;
                  
// Calculate mortgage
mortgage = ((loan * interest) * (pow(1.0 + interest, loanTime)))
    / (pow(1.0 + interest, loanTime) - 1.0);
                  
return mortgage;
}
              
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

double calcLoanAmount(double sellPrice, double downPayment)
{
/* Pre: sellPrice - sell price of house
        downPayment - down payment cost of the house
        Post: loan amount
        Purpose: Calculate the loan amount
*/
    double loanAmt;
    
    loanAmt = sellPrice - downPayment;
    
    return loanAmt;
}
              
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

void output(double sellPrice, double interestRate, int numYears, double downPayment, double loanAmount, double mortgage, double propertyTax, double insurance, double total)
{
    /* Pre: sellPrice - sell price of house
            interestRate - interest rate
            numYears - duration of loan
            downPayment - down payment for house
            downPaymentRate - down payment percentage cost for the house
            loanAmount - amount that is loaned to user
            mortgage - mortgage owed for house
            propertyTax - property taxe owed for house
            insurance - insurance owed for house
       Post: nothing
       Purpose: Output the monthly cost
    */
    
    cout << setprecision(2) << fixed;
    cout << endl;
    cout << "MONTHLY COST OF HOUSE       " << endl << endl;
    cout << "SELLING PRICE             $ " << sellPrice << endl;
    cout << "AMOUNT OF LOAN            $ " << loanAmount << endl;
    cout << setprecision(1) << fixed;
    cout << "INTEREST RATE               " << interestRate << "%" << endl;
    cout << "TAX RATE                    " << TAXRATE << "%" << endl;
    cout << "DURATION OF LOAN (YEARS)    " << numYears << endl << endl;
    cout << setprecision(2) << fixed;
    cout << "MONTHLY PAYMENT             " << endl;
    cout << "      MORTGAGE            $ " << mortgage << endl;
    cout << "      UTILITIES           $ " << UTILITIES << endl;
    cout << "      PROPERTY TAXES      $ " << propertyTax << endl;
    cout << "      INSURANCE           $ " << insurance << endl;
    cout << "                         ___________" << endl;
    cout << "                          $ " << total << endl;
    
}

        

Here is my output:

How much was the house sold for? 600000
What is the interest rate? 5
Enter the number of years for the loan: 20

MONTHLY COST OF HOUSE       

SELLING PRICE             $ 600000.00
AMOUNT OF LOAN            $ 0.00
INTEREST RATE               5.0%
TAX RATE                    0.0%
DURATION OF LOAN (YEARS)    20

MONTHLY PAYMENT             
      MORTGAGE            $ 0.00
      UTILITIES           $ 300.00
      PROPERTY TAXES      $ 0.00
      INSURANCE           $ 0.00
                         ___________
                          $ 0.00

If anyone could please provide information as to why my output doesn’t output the functions that I called, that would be very helpful!

❕NEWS – Crypto report to be released in the coming months | Proxies-free

The view of many people on cryptocurrency is not the best and some peopel are still completely against it, especially those that are at the upper levels of the governments of various countries as these coins pose a threat to the fiat currency system that they have. In a recent news article that was released, it seems that according to Jerome Powell, it is a matter of months before a report is released in order to show the manner in which cryptocurrency assets will be viewed and addressed, and this will also include addressing stablecoins as well. This report is set to be released in the early part of September of this year.

 

event based effects – When is FlixTrain coming to Sweden?

A poster here says that at least some of their assigned schedule is cancelled until Aug 30, which is short after the track closure between Malmö and Lund. So it would surprise me if they start before August (between Stockholm and Gothenburg they could start in mid August after the track closure in Stockholm), rather they might continue to push the launch forward until they are ready.

event based effects – When are FlixTrain coming to Sweden?

A poster here says that at least some of their assigned schedule is cancelled until Aug 30, which is short after the track closure between Malmö and Lund. So it would surprise me if they start before August (between Stockholm and Gothenburg they could start in mid August after the track closure in Stockholm), rather they might continue to push the launch forward until they are ready.

display – Monitor not coming back after sleep

Since upgrading to Hippo, my Insignia Fire TV I use as a monitor doesn’t come back after sleep even though my LG TV does. I have them as dual monitors extending desktop. Both are HDMI, though the Insignia uses a DVI converter since my video card only has one HDMI port.

Sometimes a reboot is enough to bring it back, sometimes I have to shut down and sometimes I have to pull the power plug (shut flipping the hard power switch isn’t enough).

If there is a window on the screen that didn’t wake up, I can turn the monitor off and Ubuntu will shift all of the windows to the visible screen, so the system’s aware of the monitor on some level.

Output of xrandr:

thomas@bravos:~$ xrandr
Screen 0: minimum 8 x 8, current 3840 x 2160, maximum 32767 x 32767
DVI-D-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 1600mm x 900mm
   3840x2160     30.00*+  59.94    50.00    29.97    25.00    23.98    23.98  
   4096x2160     59.94    50.00    29.97    25.00    24.00    23.98  
   1920x1080    119.88   100.00    60.00    59.94    50.00    29.97    25.00    23.98  
   1360x768      60.02  
   1280x1024     60.02  
   1280x720      59.94    50.00  
   1152x864      60.00  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.95    59.94    59.93  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)

As suggested by Second external monitor not waking up, tried unplugging the monitor, waiting and plugging back in. still nothing on xrandr.

Any ideas on something to try to force a re-detect?

❕NEWS – New gold-backed Token Sale is coming soon. FineBit Token® | Proxies-free

www.finebit.org

FineBit Token® IDO starts soon.
INVEST IN A GOLD_BACKED SECURE DECENTRALIZED TOKEN. IDO STARTS SATURDAY 14.08.2021

FineBit Tokenlogo150x150.png

FineBit Token® IDO.
Be a Part of our Journey to Success Worldwide. A better way for investing.

FineBit Token® is a derived digital asset, the value of which is during the IDO backed-secured by a guarantee (Notarial certificate). The whole Tokens are backed-secured during the IDO with 20.5 million USD. Participate in the success of backed-secure FineBit Token® worldwide. 100% secure for our investors. The safety and protection of our investors is our highest standard.


FineBit Token® (BEP20)
Wallet: Metamask, Trust Wallet, Binance Chain Wallet
Symbol: FBT
Decimals: 18
1 Token: 1,13 $
Max Supply: 18181818 Million
Pay with: BNB
Token Contract Address:
0x99fF6316E635B8b0e0b6053b2495b8861ee9b8c2

Token Distributed in IDO: 7.818.181 (42,99%)

The future belongs to those who take it into their own hands. Only transparency and fairness create trust. Invest in a backed-secure and decentralized FineBit Token®. Cryptoworld meets real Economy.
FineBit Token® is a registered Trademark. Registered in Germany (Patent and Trademark Office). You can check the Trademark here:
https://register.dpma.de/DPMAregister/marke/register/3020212281520/DE

OFFICIAL IDO WEBSITE: https://finebit.org

OFFICIAL TWITTER: https://twitter.com/FinebitO

OFFICIAL TELEGRAM: https://t.me/joinchat/pqt9-ClRCIpjMmM0

OFFICIAL FB: https://www.facebook.com/groups/1499324263676471/

Why FineBit Token® is going to be the next big crypto thing?
The rapid growth of the crypto trade shows that traditional finance and crypto do not have to be opposites. FineBit® can be a bridge between the crypto world and real goods (gold).

ATTENTION!

PLEASE BE AWARE! Our official site is https://finebit.org and the official contract address of our FBT BEP20 token is: 0x99fF6316E635B8b0e0b6053b2495b8861ee9b8c2

All other sites are scam! Don’t be a victim of scammers.
We never send EMAILS/CHAT with Payment Instructions different Wallet Addresses or other Payment Prompts.

You can buy our Tokens only on the Official FineBit Token® Website: finebit.org

finebitgold.jpeg

More Infos on TWITTER: https://twitter.com/FinebitO

uk – Can I interrupt quarantine to go get the 2nd dose of the vaccine after coming back from an amber list-country?

From here I read

If you have been in a country or territory on the:

  • […]
  • amber list – you must quarantine in the place you’re staying and take 2 COVID-19 tests

This makes me think I can’t leave the house, not even to only go to the place where I can get the 2nd dose of the vaccine.

I’m asking anyway to understand if that’s the case or not.

Coming Soon & Maintenance Mode PRO

Forget about complicated plugins that will waste hours of your time. We know you are busy and need quick results! Coming Soon is very easy to use, has only the features you need, and comes with themes that are right for your business.

2 million + free images. A great picture is not worth a thousand words. That’s why we’ve included over a million high quality free images to wow your visitors + Instagram-inspired filters!
170+…

.

windows 10 – How to prevent route 0.0.0.0 from coming back after route delete? Win10

This is on Windows10, I am not knowledgeable about networking or programming. Connection goes ISP-Modem-Router-My Win10 PC. Modem is connected to the router via Ethernet cable and router is connected to my Win10 PC via Ethernet cable also.

I made a batch script that starts my VPN (on my Win10 PC) and then runs
route delete 0.0.0.0 192.168.1.1 (has to be run as admin in order to work).

When I disconnect the VPN, there seems to be no internet access at all – which is exactly what I wanted. A sort of “kill switch” so that only VPN traffic is possible, even if – for example – the VPN drops unexpectedly.

I have another script ready that re-enables internet for me:
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1

That also works as intended and brings back non-vpn internet.

My problem is, somehow the route is automatically re-added by Windows or my router or I don’t know what. It just turns up after a while by itself, maybe after 10 to 20 minutes after deleting the route. I use ipconfig to test it and I see the route reappeared without me doing it, even though it was gone right after the route delete script above was executed. And I didn’t use the “add route” script neither.

Is there a way to prevent this automatic reappearance? I just want to prevent any non-VPN traffic happening when I use the VPN, even if the VPN drops unexpectedly. But I also want to not use the VPN some times, hence the scripts, so I can easily switch back and forth between the two modes.

Thank you.