Please can some one write this programe for me The major concept for this assign
ID: 3538554 • Letter: P
Question
Please can some one write this programe for me
The major concept for this assignment is basic program control using only if-else decision structures. Your program will require the calculation of a final amount given an initial investment, number of years to earn interest, and an interest rate. Your program also will calculate the number of years it would take to double the original investment amount (doubling time). Obtain a single character (A-E or a-e) input from the user for the initial investment using a menu for choices of 5000, 10000, 15000, 20000, and 25000 dollars. Match the user's character response with menu choices to determine the corresponding numeric value that will be used in the program. Assign a default value of 5000 dollars for input not matching one of the choices. Obtain numeric input from the user for the number of years that the investment will accumulate interest. If that input value is outside the required range of 5 - 30 years, assign a default value of 5 years. The interest rate will be determined by the years provided as input and according to the following: See the Considerations section about using math library functions to obtain the final amount and the number of years it would take to double the initial investment. Your program summary must print the following: the number of years invested, interest rate, initial investment amount, interest earned amount, and final amount. Each value should be identified in your output. Also, print a statement indicating the number of years it would take to double the initial investment amount. (See the included Sample Program Interaction).Explanation / Answer
//
// main.cpp
// Chegg
//
// Created by Satya Prakash on 02/07/13.
// Copyright (c) 2013 Satya Prakash. All rights reserved.
//
#include <iostream>
#include <math.h>
#include <cmath>
using namespace std;
int main(int argc, const char * argv[])
{
char initial_investment_choice;
int initial_investment=5000;
int yearOfInvestment;
double interestRate=0.03;
cout << "Enter the Initial Investment : "<<endl;
cout << "press 'A' or 'a' for 5000 dollors"<<endl;
cout << "press 'B' or 'b' for 10000 dollors"<<endl;
cout << "press 'C' or 'c' for 15000 dollors"<<endl;
cout << "press 'D' or 'd' for 20000 dollors"<<endl;
cout << "press 'E' or 'e' for 25000 dollors"<<endl;
cin >>initial_investment_choice;
if (initial_investment_choice=='A' || initial_investment_choice== 'a') {
initial_investment=5000;
}
else if (initial_investment_choice=='B' || initial_investment_choice== 'b'){
initial_investment=10000;
}
else if (initial_investment_choice=='C' || initial_investment_choice== 'c'){
initial_investment=15000;
}
else if (initial_investment_choice=='D' || initial_investment_choice== 'd'){
initial_investment=20000;
}
else if (initial_investment_choice=='E' || initial_investment_choice== 'e'){
initial_investment=25000;
}
cout <<"Enter number of years for investment between 5 and 30 :"<<endl;
cin >>yearOfInvestment;
if (yearOfInvestment>=30 || yearOfInvestment <=5) {
yearOfInvestment=5;
}
if (yearOfInvestment>=25) {
interestRate=0.05;
}
else if(yearOfInvestment>=20)
{
interestRate=0.045;
}
else if (yearOfInvestment <20 && yearOfInvestment >=15){
interestRate=0.04;
}
else if (yearOfInvestment <15 && yearOfInvestment >=10){
interestRate=0.035;
}
else if (yearOfInvestment <10){
interestRate=0.03;
}
double interest = initial_investment*yearOfInvestment*interestRate;
double finalAmount=initial_investment+interest;
double yearForDoubleing= 1/interestRate;
int year=ceil(yearForDoubleing);
cout << "Initial Investment = "<< initial_investment <<endl;
cout << "The number of years invested = "<<yearOfInvestment <<endl;
cout << "Interest rate = " <<interestRate <<endl;
cout << "Interest earned amount = "<<interest <<endl;
cout << "Final amount = "<<finalAmount <<endl;
cout << "Number of year it would take to double the amount= "<< yearForDoubleing << " that means at least "<<year<<endl;
return 0;
}