Depreciation Table

I need a help..this is for my project....

i need to create an depreciation table using do while loop in c++.....


method to be used are:

straight line method
sum of the years digit
double declining balance...


urgent response is much appreciated...




closed account (z05DSL3A)
If you are looking for someone to give you the code, you will probably be out of luck.


How it works here:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    while(!finished)
    {
        do
        {
            writeCode();
        }while(!stuck);
        
        if(stuck)
        { 
            postCode();
            AskSpecificQuestion();
            GetAnswer();
        }
    }
    HandInCourseWork();

Last edited on
# include <iostream>
# include <iomanip>
# include <cassert>
using namespace std;
void straightline (double amount, int numyears)
{
double depreciation= amount/numyears;
cout<<"\nYear - Depreciation";
cout<<"\n-------------------n";
cout<< fixed<<showpoint<<right
<< setprecision(2);


for( int year=1; year<=numyears; year++)
cout << setw(3) <<year;
cout<< setw(13)<<depreciation<<endl;

}



i cant compile!!! what is the prolem?
closed account (z05DSL3A)
You have no main function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <iomanip>
#include <cassert>
using namespace std;

void straightline (double amount, int numyears)
{
    double depreciation= amount/numyears;
    cout<<"\nYear - Depreciation";
    cout<<"\n-------------------n";
    cout<< fixed<<showpoint<<right
    << setprecision(2);


    for( int year=1; year<=numyears; year++)
    cout << setw(3) <<year;
    cout<< setw(13)<<depreciation<<endl;
}

int main()
{
    return 0;
}



NB: when posting code put [code] above your code, and [/code]below it.
[code]
int main()
{
return 0;
}
[/code]

will display as

1
2
3
4
int main()
{
    return 0;
}
Last edited on


Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;
int main()
{

    double amount, depreciation;
    int numyears,yearsum;

    cout<<"Enter the Value:";
    cin >>amount;
    cout<<"Enter the number of useful years:";
    cin>>numyears;
    cout<<"\nYear-Depreciation-RealizableValue";
    cout<<"\n-------------------------------\n";

    yearsum=sum(numyears);

    cout<<fixed<<showpoint<<right<<setprecision(2);

    for (int year=1; year<=numyears; year++)
    depreciation=(numyears-year*1)*amount/yearsum;
    realizable=amount-depreciation;
    cout<<setw(3)<<year;
    cout<<setw(13)<<depreciation<<endl;
    cout<<realizable<<endl;

    return 0;
}
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
using namespace std;
int main()
{
    double amount,depreciation,realizable;
    int numyears;


    cout<<"Enter the Value:";
    cin >>amount;
    cout<<"Enter the number of useful years:";
    cin>>numyears;

    depreciation= amount/numyears;
    realizable=amount-depreciation;

    cout<<"\nYear - Depreciation-Net Realizable Value";
    cout<<"\n-------------------n";
    cout<< fixed<<showpoint<<right;
    cout<<depreciation<<endl;

    for( int year=1; year<=numyears; year++);
    cout<<year;
    cout<<depreciation<<endl;
    cout<<realizable<<endl;




    return 0;
}
Last edited on
Topic archived. No new replies allowed.