Sunday, June 30, 2024

Is having a real estate business a good business?

Benefits of having an MBA degree

What is Master of Business Administration

Bank Account in C++

Bank Account in C++

 




Program Listing


#include <iostream>

#include <iomanip>


class BankAccount {

private:

    double balance;


public:

    BankAccount() : balance(0.0) {}


    void deposit(double amount) {

        if (amount > 0) {

            balance += amount;

            std::cout << "\tDeposited PHP" <<std::fixed <<std::setprecision(2) << amount << ". New balance: PHP" << balance << std::endl;

        } else {

            std::cout << "\tInvalid deposit amount." << std::endl;

        }

    }


    void withdraw(double amount) {

        if (amount > 0 && amount <= balance) {

            balance -= amount;

            std::cout << "\tWithdrawn PHP" <<std::fixed <<std::setprecision(2)<< amount << ". New balance: PHP" << balance << std::endl;

        } else {

            std::cout << "\tInvalid withdrawal amount or insufficient funds." << std::endl;

        }

    }


    double getBalance() const {

        return balance;

    }

};


int main() {

    BankAccount account;

    int choice=0;

    double amount=0.00;


    while (true) {

        std::cout << "\n\tBank Account Main Menu" << std::endl;

        std::cout << "\t[1] Deposit Money" << std::endl;

        std::cout << "\t[2] Withdraw Money" << std::endl;

        std::cout << "\t[3] Check Balance" << std::endl;

        std::cout << "\t[4] Quit Program" << std::endl;

        std::cout << "\n\tEnter your choice: ";

        std::cin >> choice;


        switch (choice) {

            case 1:

                std::cout << "\tEnter the deposit amount: PHP";

                std::cin >> amount;

                account.deposit(amount);

                break;

            case 2:

                std::cout << "\tEnter the withdrawal amount: PHP";

                std::cin >> amount;

                account.withdraw(amount);

                break;

            case 3:

                std::cout << "\tCurrent balance: PHP" <<std::fixed <<std::setprecision(2)<< account.getBalance() << std::endl;

                break;

            case 4:

                std::cout << "\tExiting. Thank you for using this program." << std::endl;

                return 0;

            default:

                std::cout << "\tInvalid choice. Please try again." << std::endl;

        }

    }


    return 0;

}


What is PostreSQL?

Friday, June 28, 2024

Temperature Converter Using Encapsulation in C++

 




#include <iostream>


class TemperatureConverter {

private:

    double celsius;

    double fahrenheit;


public:

    TemperatureConverter() : celsius(0.0), fahrenheit(32.0) {}


    void setCelsius(double c) {

        celsius = c;

        fahrenheit = (celsius * 9.0/5.0) + 32.0;

    }


    void setFahrenheit(double f) {

        fahrenheit = f;

        celsius = (fahrenheit - 32.0) * 5.0/9.0;

    }


    double getCelsius() const {

        return celsius;

    }


    double getFahrenheit() const {

        return fahrenheit;

    }

};


int main() {

    TemperatureConverter converter;


     std::cout << "\n\tTemperature Converter Using Encapsulation in C++\n\n";

    // Convert from Celsius to Fahrenheit

    converter.setCelsius(35.0);

    std::cout << "\t35 degrees Celsius is equal to " << converter.getFahrenheit() << " degrees Fahrenheit.\n";


    // Convert from Fahrenheit to Celsius

    converter.setFahrenheit(112.3);

    std::cout << "\n\tEnd of Program\n\n";

    return 0;

}


What is Mass Media?

What is Media?

Thursday, June 27, 2024

What is a Sales Engineer?

What is Decryption?

Area of the Circle Using OOP Approach in C++

Area of the Circle Using OOP Approach

 #include <iostream>

#include <iomanip>


class Circle {

public:

    // Constructor to initialize the radius

    Circle(double radius) {

        this->radius = radius;

    }


    // Method to calculate the area of the circle

    double calculateArea() {

        return 3.14159265359 * radius * radius;  // Assuming Pi to be approximately 3.14159265359

    }


    // Method to calculate the circumference of the circle

    double calculateCircumference() {

        return 2.0 * 3.14159265359 * radius;  // Assuming Pi to be approximately 3.14159265359

    }


private:

    double radius;

};


int main() {

    double radius;


    // Input the radius of the circle

    std::cout << "\n\tArea of the Circle Using OOP Approach\n";

    std::cout << "\n\tEnter the radius of the circle: ";

    std::cin >> radius;


    // Create a Circle object with the provided radius

    Circle circle(radius);


    // Calculate and display the area and circumference

    double area = circle.calculateArea();

    double circumference = circle.calculateCircumference();


    std::cout << "\n\tThe Area of the circle: " <<std::fixed <<std::setprecision(2) << area << std::endl;

    std::cout << "\tThe Circumference of the circle: " <<std::fixed <<std::setprecision(2) <<  circumference << std::endl;

    std::cout << "\n\n\tEnd of Program. Thank you for using this program." << std::endl;

    return 0;

}