Calculate the inflation premium for a given nominal interest rate and expected inflation rate.

## Introduction

The Inflation Premium Calculator is a web-based tool that allows users to calculate the inflation premium based on two input values: the nominal interest rate and the expected inflation rate. The inflation premium represents the difference between the nominal interest rate and the expected inflation rate, providing insights into the real return on an investment or loan.

## Input Section

• Nominal Interest Rate (%):Users enter the nominal interest rate as a percentage. This rate typically represents the interest rate stated by a financial institution or the rate associated with an investment or loan.
• Expected Inflation Rate (%): Users input the expected inflation rate as a percentage. This rate reflects the anticipated increase in the general price level over time.

## Calculation

• When the user clicks the “Calculate” button, the JavaScript function calculateInflationPremium() is triggered.
• The function retrieves the values entered for the nominal interest rate and expected inflation rate from the input fields.
• It checks if both values are valid numbers. If not, it displays an error message asking the user to enter valid numbers.
• If the input values are valid, the function calculates the inflation premium using the following formula:

Inflation Premium = Nominal Interest Rate – Expected Inflation Rate

The formula simply subtracts the expected inflation rate from the nominal interest rate to determine the inflation premium

## Output Section

• After performing the calculation, the calculator displays the result in the “result” section.
• The result is presented as “Inflation Premium: [value]%” with the calculated inflation premium value rounded to two decimal places.
• The result provides users with the inflation premium percentage, which indicates how much the real return or interest rate differs from the expected inflation rate.

## Error Handling

• The calculator includes error handling to ensure that users input valid numerical values for the nominal interest rate and expected inflation rate.
• If invalid inputs are detected, an error message is displayed, prompting users to correct their input.

## Visual Styling

• The calculator features an attractive and user-friendly design with CSS styles that improve readability and aesthetics.
• It uses a responsive layout that adapts to different screen sizes.