Question

In: Computer Science

Write a program to calculate the amount of money in an account: The user will input...

Write a program to calculate the amount of money in an account:

The user will input initial deposit and the number of years to leave that money in the account.

The interest is constant at 0.5% for the entire length of time.

The output will be the balance, with interest compounded annually.

(simple interest formula: interest = principal * rate)

  1. What variables will you need to complete the program?





  2. What “controls” will you need for the program?






  3. What formula will you use? (give to you already!)







  4. Make the program user friendly!! (ideas for that?)

Solutions

Expert Solution

Program:-

#include <stdio.h>
#include <math.h>
main(){
   float p,r,a;
   int n,t;
   printf("Enter initial deposit: ");
   scanf("%f",&p);
   printf("Enter No of years: ");
   scanf("%d",&t);
   n = 1; //Since interest compounded annually
   r = 0.005; // rate = 0.5/100
   a = p * pow((1 + (r/n)),(n * t)); // FORMULA:- A = P*((1 + r/n) ^ n*t)
   printf("Money: %0.2f",a);   
}

Variables Needed:-

p -> Initial deposit

r -> annual interest rate

n -> no of times interest compounded in an year

t -> time

a -> final amount

FORMULA:-

A = p * ((1 + n/t) ^ n*t)

OUTPUT:-

If you have any doubts , comment below. THANK YOU!!! Please rate the answer


Related Solutions

Write a program that will accept user input for an initial deposit and a total amount...
Write a program that will accept user input for an initial deposit and a total amount the user wants to have, and will output the number of years it will take to reach his/her goal. For the basic program, the user will deposit the initial amount in a new account, and then the account will receive interest, compounded MONTHLY, at a rate of 0.5%.
Write a program that will accept user input for an initial deposit and a total amount...
Write a program that will accept user input for an initial deposit and a total amount the user wants to have, and will output the number of years it will take to reach his/her goal. For the basic program, the user will deposit the initial amount in a new account, and then the account will receive interest, compounded MONTHLY, at a rate of 0.5%. Then modify it by allowing the user to set a fixed amount to be deposited into...
User the Scanner class for your input Write a java program to calculate the area of...
User the Scanner class for your input Write a java program to calculate the area of a rectangle. Rectangle Area is calculated by multiplying the length by the width   display the output as follow: Length =   Width = Area = Load: 1. Design (Pseudocode ) 2. Source file (Java file, make sure to include comments) 3. Output file (word or pdf or jpig file)
write a program that takes two input values from the user and calculate the division if...
write a program that takes two input values from the user and calculate the division if the first number is greater than the second one otherwise calculate the multiplication.
write a program that takes the input value from the user and calculate the sum from...
write a program that takes the input value from the user and calculate the sum from that number to zero in MIPS
Write Java program that asks a user to input a letter, converts the user input to...
Write Java program that asks a user to input a letter, converts the user input to uppercase if the user types the letter in lowercase, and based on the letter the user the user enters, display a message showing the number that matches the letter entered. For letters A or B or C display 2 For letter D or E or F display 3 For letter G or H or I display 4 For letter J or K or L...
Write a C++ Program Write a program that prompts the user to input a string. The...
Write a C++ Program Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str=”There”, then after removing all the vowels, str=”Thr”. After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel. You must insert the following comments at the beginning...
Write a program that prompts the user to input a string. The program then uses the...
Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str=”There”, then after removing all the vowels, str=”Thr”. After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel. You must insert the following comments at the beginning of your program and...
Write a program to help a small company calculate the amount of money to pay its...
Write a program to help a small company calculate the amount of money to pay its employees. In this simplistic world, the company has exactly three employees. However, the number of hours per employee may vary. The company will apply the same tax rate to every employee The program must be written in Java. Prompt the user for the inputs and store the values in variables Must include all the inputs and outputs listed here and perform the calculations correctly...
Write a java program. The program requirements are: the program will let the user input a...
Write a java program. The program requirements are: the program will let the user input a starting number, such as 2.  It will generate ten multiplication problems ranging from 2x1 to 2x10.  For each problem, the user will be prompted to enter the correct answer. The program should check the answer and should not let the user advance to the next question until the correct answer is given to the question being asked currently. After testing a total of 10 multiplication problems,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT