Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 14 pages
Other

COS1512 ASSIGNMENT 2 SOLUTIONS 09 JULY 2023

Document preview thumbnail
Preview 2 out of 14 pages

This document contains the codes solutions in c++ along with the screen output for the required questions. All codes working and we'll written.

Content preview

COS1512 ASSIGNMENT 2 2023


QUESTION 1

#include <iostream>
using namespace std;
double calcFees(int nrModules,double fees)
{
return nrModules*fees;


}
double calcFees(int firstModule,double firstFees,int repModules,double repFees)
{


double total;
total=firstModule*firstFees+repModules*repFees;
return total;
}
int main()
{




char answer;
cout<<"Are you repeating any modules:Y\\N: ";
cin>>answer;
int firstModules;

, double firstFees;
if(answer=='Y')
{


double repFees;
int repModule;
cout<<"Enter the number of modules you are doing first time: ";
cin>>firstModules;
cout<<"Enter the fees for first time modules: ";
cin>>firstFees;
cout<<"Enter the number of modules you are repeating: ";
cin>>repModule;
cout<<"Enter the fees for modules repeated: ";
cin>>repFees;
cout<<"Your tuition fees are: R"<<calcFees(firstModules,firstFees,repModule,repFees);
}
else
{
cout<<"Enter the number of modules you are doing first time: ";
cin>>firstModules;
cout<<"Enter the fees for first time modules: ";
cin>>firstFees;
cout<<"Your tuition fees are: R"<<calcFees(firstModules,firstFees);


}
return 0;


}

Document information

Uploaded on
July 8, 2023
Number of pages
14
Written in
2022/2023
Type
Other
Person
Unknown
$12.79

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ThinkLab
4.0
(21)
Sold
171
Followers
118
Items
107
Last sold
10 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions