Can someone help me write a retirement calculator program in c code. I want to write a program that the user can enter their age, amount they wish to save each month, the interest rate, and the age they wish to retire. I would like to use a switch loop, if else loop or do while loop. the output should show them how much they should have in a retirement savings account at the age they wish to retire at. This has to be in C code. Someone helped me with a good working code. but I don't think it was compounding to what I was looking for. I was looking to use a future sum equation like futureValue = savingAmt * pow(1 + intRate / periods, -1 / periods); Thank You in advance.

#include <stdio.h>
#include <math.h>
//This function returns total savings
//It takes current age, monthly deposit, rate and retirement age as
arguments
double savingsAmount(int age, double monthly_amount, double
yearly_rate, int retirement_age)
{
double amount = 0; //To store total savings
int years = retirement_age - age; //Total years
if(years <= 0) //invalid input
return 0;
//Use : futureValue = savingAmt * pow(1 + intRate / periods, -1 /
periods)
//Assume compounding occurs quarterly, i.e every 4 months
int N = 4;
int t = years*12;
yearly_rate = yearly_rate/100.0; //Convert % to decimals
while(t)
{
amount += monthly_amount * pow((1 + yearly_rate/N), N*t/12.0)
;
t--;
}
return amount; //Final amount
}
int main(void) {
char ch = 'Y'; int age, retirement_age;
double monthly_amount, yearly_rate;
do{
printf("Enter age : "); scanf("%d", &age);
printf("Enter monthly amount to deposit : "); scanf("%lf",
&monthly_amount);
printf("Enter yearly_rate : "); scanf("%lf",
&yearly_rate);
printf("Enter retirement_age : "); scanf("%d",
&retirement_age);
//Call function
double ret_amount =
savingsAmount(age,monthly_amount,yearly_rate,retirement_age);
printf("Total savings amount = %lf \n", ret_amount);
printf("Try again ? Y/N : "); scanf(" %c", &ch);
}while(ch=='Y' || ch=='y');
return 0;
}
Can someone help me write a retirement calculator program in c code. I want to write...
Can someone help me with these C program problems? Thanks 1. Write a C program that creates two arrays of integers, one on the stack and one on the heap. You will loop through these arrays and populate them with values (any value is fine). You will then loop through these arrays again and print each value. Your output should look something like “Value in index 1 is 100 from stack array and 100 from heap array.” Do not forget...
Can someone help me with a simple C programming problem? How do I make some code like this into its own function? Currently it's pat of the main function, but I want to be able to call it. If you could help me with the prototype, function call, and definition, I'd really appreciate it. Thanks! if(some_input=='r'){ someone = 0; } else if(some_input=='p'){ someone = 1; } else if(some_input=='s'){ someone = 2; } else if(some_input=='q' || some_input=='Q'){ break; // Breaks...
CAN SOMEONE PLEASE HELP ME WRITE THIS CODE IN C++, PLEASE HAVE
COMMENTS IN THE CODE IF POSSIBLE!!
General Description: Write a program that allows the user to enter data on their friends list. The list holds a maximum of 10 friends, but may have fewer. Each friend has a name, phone number, and email address. The program first asks the user to enter the number of friends (1-10). You are not required to validate the entry, but you may...
Can someone help me with this PHP code thank you in advance!! Write a PHP program to print the first 10 terms of a Fibonacci sequence. You need to use arrays to store and print the terms. In the Fibonacci sequence, the next number is found by adding up the two numbers before it. The Fibonacci Sequence starts with 0 and 1 as the first two terms. So F[0]=0 and F[1]=1 and the series propagates such that F[n]= F[n-1]+F[n-2]. The...
Can someone help me write a C++ program such that: 1. It counts the number of alphabetic characters in a text file; this mean it ignores any character that is not alphabetic 2. Prompts the user to write the name of the file 3. Count's the number of A's, B's, C's, ..and so on For the sake of this program, both capital 'A' and lowercase 'a' and treated as equal. An output would something like this "A's = 10 B's...
I need help with this code: Write a program that calculates the future value of an investment at a given interest rate for a specified number of years. The formula for the calculation is as follows: futureValue = investmentAmount * (1 + monthlyInterestRate)years*12 Use text fields for interest rate, investment amount, and years. Display the future amount in a text field when the user clicks the Calculate button, as shown in the following figure. It needs to be done in...
Help me write a python code. Write a program that asks the user for the name of a text file, then reads each line of the text file and prints it on the screen, making every other line "title case." For example, suppose the following text is saved in my_file.txt: While I nodded, nearly napping Suddenly there came a tapping As of someone gently rapping, Rapping at my chamber door. When run, the program looks like this: Enter filename: While...
Can someone help me with this Python code Summary In this lab, you work with the same Python program you worked with in Labs 5-1 and 5-3. As in those earlier labs, the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. However, in this lab you should accomplish this using a while loop with a break statement. Instructions Make sure that the file NewestMultiply.py is selected and open. Write...
Can someone help me solve this MIPS question, it must
be able to run on qtspim.
Write a MIPS code which involves three functions: a. main b. poly C. Pow to compute the value of the polynomial given below for any value of x, as given by the user. f(x) = 3x + 2x4 - 5x +7-6 Your program must pass arguments to functions such as poly and pow and get return values from these functions. The input to the...
Can you help me write a Python 3.7 code for this question? Write a program using functions and mainline logic which prompts the user to enter a number, then generates that number of random integers and stores them in a list. It should then display the following data to back to the user: The list of integers The lowest number in the list The highest number in the list The total sum of all the numbers in the list The...