Answer to Question #339887 in C++ for alemante teju

Question #339887

3) Write a C++ program to solve the following problems (Red colour texts are to indicate user inputs that can be changed)

A) Calculate the area of a circle by accepting the radius of the circle from the user (NB: Area of Circle = 2חr)

Out Put

What is the radius of the circle: 10

Area = 62.8

B) Calculate the factorial of any integer number input from the user (NB: 4! = 1 * 2 * 3 * 4 = 24)

    Out Put

    Enter an Integer Number: 4

    4! = 24

C) Waliya Bank is giving 7% interest for customer deposit, write a C++ program which enables customers to predict their total balance if they deposit an amounts and keep it for some time

    Out Put

    Enter your Account Number: 2000342200267

    Enter your Name: Abebe Kebede

    Enter the amount: 1000

    How long to keep it (number of month): 10

Dear Abebe Kebede

Acc: 2000342200267

After 10 Months you will get a total of 700 Birr Interest

Your Balance will be = 1700 Birr

1
Expert's answer
2022-05-12T15:10:38-0400
//A)-------------------
#include <iostream>
using namespace std;

int main()
{
    const double pi = 3.14;
    unsigned int radius;
    cout << "What is the radius of the circle: ";
    cin >> radius;
    
    double area = 2 * pi * radius;
    cout << "Area = " << area << endl;
}

Hello. I think there is an error in the task. What do I need to find: the circumference (2 * pi * radius) or the area of the circle (pi * radius * radius)?


//B-------------------------

#include <iostream>
using namespace std;

int main()
{
    unsigned int  number;
    cout << "Enter an Integer Number: ";
    cin >> number;
    
    unsigned long long int factorial = 1;
    
    for(unsigned int i = 1; i <= number; ++i)
    {
        factorial *= i;
    }
    
    cout << number << "! = " << factorial << endl;
}

//C-------------------------

#include <iostream>
#include <string>

using namespace std;

int main()
{
    long long number;
    cout << "\tEnter your Account Number: ";
    cin >> number;

    string name= "Abebe Kebede ";
    cout << "\tEnter your Name: "<< name << endl;
          
    int amount;
    cout << "\tEnter the amount: ";
    cin >> amount;
    
    int nmonth;
    cout << "\tHow long to keep it (number of month): ";
    cin >> nmonth;
    
    cout<<endl;
    
    cout << "Dear " << name << endl;
    cout <<"Acc: "<<number<< endl;
    int total = nmonth * amount *  7 / 100;
    cout << "After " << nmonth << " Months you will get a total of " << total << " Birr Interest" << endl;
    cout << "Your Balance will be = " << amount +  total << " Birr " << endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS