Answer to Question #156934 in C++ for Raihan Afryna binti Raizam

Question #156934

A machine purchased for RM28,000 is depreciated at a rate of RM4,000 a year for 7 years.

Write and run a C++ program that computes and displays a depreciation table for 7 years.


1
Expert's answer
2021-01-23T17:12:12-0500
#include <iostream>

using namespace std;

int main()
{
    int cost = 28000;
    cout << "Purchased cost: RM" << cost << endl << endl;

    cout << "Depreciation table:" << endl;
    int depr_rate = 4000;
    for (int i = 1; i <= 7; i++) {
        cout << "Year " << i << ": cost = RM" << cost - depr_rate * i << 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