espiktarenko/mortgage

There is no license information available for the latest version (v1.0.0) of this package.

mortgage calculate

v1.0.0 2023-11-17 14:40 UTC

This package is not auto-updated.

Last update: 2024-09-21 17:06:22 UTC


README

This is a PHP class that calculates the cost of a mortgage based on the sum, years, and interest rate.

Installation

The package can be installed via Composer by running the following command:

composer require espiktarenko/mortgage

Usage

First, include the class in your PHP file:

require_once 'path/to/MortgageCount.php';

Then, create an instance of the MortgageCount class:

$mortgage = new Espiktarenko\Mortgage\MortgageCount();

To calculate the cost of a mortgage, call the mortgage method and pass in the sum, years, and interest rate as parameters:

$cost = $mortgage->mortgage($sum, $years, $interestRate);

The method will return the calculated cost of the mortgage.

If any of the parameters are null, the method will return the string "Not enough data".

Example

$mortgage = new Espiktarenko\Mortgage\MortgageCount();

$sum = 100000; // The loan amount
$years = 10; // The loan term in years
$interestRate = 5; // The interest rate in percentage

$cost = $mortgage->mortgage($sum, $years, $interestRate);

This will output: "It'll cost you: 50000".

Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

This project is licensed under the MIT License. See the LICENSE file for details.