cout << \"\\tDividends: \"<< endl; totaldividend=0; for(i=0; i<numStocks;i++) {
ID: 3617399 • Letter: C
Question
cout << " Dividends: "<< endl;
totaldividend=0;
for(i=0; i<numStocks;i++)
{
divA=div[i].getDividend();
totaldividend += divA;
cout <<" " << div[i].getName() <<" "<< "" << divA <<endl;
}
cout << " TotalDividends: " <<totaldividend << endl;
cout << " CapitalGains: " <<setprecision(2) << fixed << capFile1.getCapitalGains()<< endl;
cout << " Totalincome: " <<setprecision(2) << fixed <<incomeFile1.getGrossIncome() << endl;
cout << " " << endl;
cout << "Exemption: "<< endl;
cout << " Donations: " <<endl;
totalexempt = 0;
for(i=0; i<numDon;i++)
{
don1 = ex[i].getDonation();
totalexempt += don1;
cout <<" " << ex[i].getName() <<" "<< "" << don1 <<endl;
Explanation / Answer
cout << " Dividends:" << endl;
totaldividend=0;
for(i=0; i<numStocks;i++)
{
divA=div[i].getDividend();
totaldividend += divA;
cout<<setw(20)<<left<<div[i].getName()<<setw(10)<<divA<<endl;
}
cout << " TotalDividends: " <<totaldividend << endl;
cout << " CapitalGains: " <<setprecision(2) << fixed << capFile1.getCapitalGains()<< endl;
cout << " Totalincome: " <<setprecision(2) << fixed <<incomeFile1.getGrossIncome() << endl;
cout << " "<< endl;
cout << "Exemption:" << endl;
cout << " Donations: " << endl;
totalexempt = 0;
for(i=0; i<numDon;i++)
{
don1 = ex[i].getDonation();
totalexempt += don1;
cout <<setw(20)<<left<<ex[i].getName() << setw(10)<<don1 << endl;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.