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

Question #156676

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-21T03:19:34-0500
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
    int purchased_price = 28000;
    int rate = 4000;
    int year = 7;
    cout << setw(7) << "YEAR" << setw(16) << "DERPRICIATION" << setw(20) << "END-OF-YEAR VALUE" << setw(27) << "ACCUMULATED DEPRICIATION\n";
    cout << setw(7) << "____" << setw(16) << "_____________" << setw(20) << "_________________" << setw(27) << "________________________\n";
    for (int i = 0; i < year; i++) {
        cout << setw(7) << i + 1 << setw(16) << rate << setw(20) << purchased_price - rate * (i + 1) << setw(27) << rate * (i + 1) << 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