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.
#include <iostream>
using namespace std;
int main(){
int year = 1, dep = 4000, accDe = 0, EOYVal = 28000;
cout << endl << " \t \tEND-OF-YEAR\tACCUMULATED" << endl;
cout <<"YEAR\tDEPRECIATION\tVALUE\t\tDEPRECIATION" << endl;
cout << "----\t------------\t-----\t\t------------" << endl;
while(EOYVal > 0){
EOYVal -= dep;
accDe += dep;
cout << year << "\t " << dep << "\t\t" << EOYVal << "\t\t" << accDe << endl;
year++;
}
return 0;
}
Comments
Leave a comment