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

Question #156851

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-22T15:03:56-0500
#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;
}

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