PROGRAMMING ASSIGNMENT
PROGRAMMING ASSIGNMENT
QUESTION 1:
#include <iostream>
using namespace std;
int main (){
int cs;
float ai, ed, lr;
cout<<"Enter your credit score"<<endl;
cin>>cs;
}
else if (cs < 600) {
cout<<" Your loan is rejected"<<endl;
}
else if (lr>ai){
cout<<"Your loan is rejected"<<endl;
}
return 0;
}
QUESTION 2:
#include <iostream>
#include <string>
using namespace std;
int main(){
float ta, time;
string membership;
cout<<"Enter trade amount"<<endl;
cin>>ta;
if (ta > 10000){
cout<<"What membership do you have (Premium/Regular)?"<<endl;
cin>>membership;
if (membership == "Premium" or membership == "premium"){
cout<<"Flat fee is 2%"<<endl;
ta = ta * 0.02;
cout<<"Amount of fee = "<< ta<<endl;
}
else if(membership == "Regular" or membership == "regular") {
cout<<"Flat fee is 3%"<<endl;
ta = ta * 0.03;
cout<<"Amount of fee = "<< ta<<endl;
}
}
if (ta >=1000 and ta <=10000){
cout<<"What membership do you have (Premium/Regular)?"<<endl;
cin>>membership;
cout<<"For how many years have you been a user"<<endl;
cin>>time;
if (membership== "Regular" or membership == "regular") {
cout<<"Flat fee is 4%"<<endl;
ta = ta * 0.04;
cout<<"Amount of fee = "<< ta<<endl;
}
else if (time>5){
cout<<"Flat fee is 2%"<<endl;
ta = ta * 0.02;
cout<<"Amount of fee = "<< ta<<endl;
}
}
else if (ta < 1000) {
cout<<"Flat fee is 5%"<<endl;
ta = ta * 0.05;
cout<<"Amount of fee = "<< ta<<endl;
}
return 0;
}
QUESTION 3:
#include <iostream>
using namespace std;
int main() {
int baseCount, finalCount, index, extraCount;
cout << "Enter the initial number of transactions: ";
cin >> baseCount;
cout << "Enter the number of additional transactions: ";
cin >> extraCount;
finalCount = baseCount;
for (index = 0; index < extraCount; index++) {
if (index % 2 == 0) {
finalCount++;
} else {
++finalCount;
}
}
cout << "Total number of transactions: " << finalCount << endl;
cout << "Total transaction fee: $" << totalCost << endl;
return 0;
}
QUESTION 4:
#include <iostream>
using namespace std;
int main() {
int ratingScore;
float yearlyEarnings, currentDebt, requestedLoan;
cout << "How much loan are you requesting" << endl;
cin >> requestedLoan;
if (ratingScore > 700 and yearlyEarnings >= 3 * requestedLoan) {
cout << "Your loan amount is approved" << endl;
}
else if (ratingScore >= 600 and ratingScore <= 700) {
if (yearlyEarnings >= 5 * requestedLoan && currentDebt <= 0.5 * yearlyEarnings) {
cout << "Your loan amount is approved" << endl;
} else {
cout << "Your loan is not approved" << endl;
}
}
else if (ratingScore < 600) {
cout << "Your loan is rejected" << endl;
}
else if (requestedLoan > yearlyEarnings) {
cout << "Your loan is rejected" << endl;
}
return 0;
}
QUESTION 5:
#include <iostream>
using namespace std;
int main() {
float netEarnings, tradeCount;
return 0;
}
QUESTION 6:
#include <iostream>
#include <string>
using namespace std;
int main() {
float transactionValue, userDuration;
string accountType;
if (accountType == "premium") {
cout << "Flat fee will be 2%" << endl;
transactionValue = transactionValue * 0.02;
cout << "Amount of fee is " << transactionValue << endl;
}
else if (accountType == "regular") {
cout << "Flat fee will be 3%" << endl;
transactionValue = transactionValue * 0.03;
cout << "Amount of fee is " << transactionValue << endl;
}
}
if (accountType == "regular") {
cout << "Flat fee will be 4%" << endl;
transactionValue = transactionValue * 0.04;
cout << "Amount of fee is " << transactionValue << endl;
}
else if (userDuration > 5) {
cout << "Flat fee will be 2%" << endl;
transactionValue = transactionValue * 0.02;
cout << "Amount of fee is " << transactionValue << endl;
}
}
else if (transactionValue < 1000) {
cout << "Flat fee will be 5%" << endl;
transactionValue = transactionValue * 0.05;
cout << "Amount of fee is " << transactionValue << endl;
}
return 0;
}
QUESTION 7:
#include <iostream>
using namespace std;
int main() {
float yearlyEarnings, ratingScore;
return 0;
}
QUESTION 8:
#include <iostream>
#include <string>
using namespace std;
int main() {
float transactionValue;
string accountCategory;
return 0;
}
QUESTION 9:
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int transferAmount;
cout << "Enter the amount you want to transfer" << endl;
cin >> transferAmount;
if (transferAmount % 100 == 0) {
cout << "Transaction fee is 2%" << endl;
transferAmount = transferAmount * 0.02;
cout << "Fee amount is " << transferAmount << endl;
}
else {
cout << "Transaction fee is 3%" << endl;
transferAmount = transferAmount * 0.03;
cout << "Fee amount is " << transferAmount << endl;
}
return 0;
}