CSC 201 Assignment Ademola Adetunji David
CSC 201 Assignment Ademola Adetunji David
ASSIGNMENT QUESTIONS
1) *1.are on 3K one off, expires 05/12/2023, 13:00am your data balance is 5905mb and browse
for 1062 mins write a c++ program to implement
C++ code
#include <iostream>
#include <iomanip>
struct DataUsage {
int initialDataBalance;
int dataUsedPerMinute;
};
int main() {
DataUsage usage = {3000, 5}; // Initial data balance and data used per minute
int dataBalance = 5905; // in megabytes
int browseDuration = 1062; // in minutes
// Display results
std::cout << "Initial data balance: " << usage.initialDataBalance << " MB" << std::endl;
std::cout << "Data used during browsing: " << dataUsed << " MB" << std::endl;
std::cout << "Remaining data balance: " << remainingData << " MB" << std::endl;
return 0;
}
2.Your last call was 18 seconds at #6.06 include VAT, new balance is 1869.92. Write a C++ program to
implement this
Code:
#include <iostream>
using namespace std;
int main() {
double currentBalance = 1869.92;
int callDuration = 18;
double callRate = 6.06;
double vat = 0.06;
cout << "New balance after the call: $" << newBalance << endl;
return 0;
}
3. Your course rep by name "Mary" has just deposited the sum of 100,000 in her current account,
Caleb University Assuming that 10% interest is compounded annually, earned on that amount, how
much is due to her at the end of 5 years.
Hint :
1) Present value is requested to be compounded
i) Future value is unknown
Write a c++ Value to assist Mary future value of her investment in her Current account
Code:
#include <iostream>
#include <cmath>
int main() {
// Present Value
double PV = 100000.0;
// Number of years
int years = 5;
return 0;
}
4.4.Mr Obafemi is an undergraduate computer science in Caleb University and his roomate ask him
to help him find out how much he will earn at the end of 4 yrs if he deposit N100,00 annually in my
bank witch pays 4% per annum Write a C+ program to assist your course mate
Code
#include <iostream>
#include <cmath>
struct Investment {
double annualDeposit;
double interestRate;
};
int main() {
Investment investment = {100000.0, 0.04}; // in Naira and 4% interest rate
const int years = 4;
return 0;
}
5.:write a c++ program to calculate the area of a circle
Code:
#include <iostream>
#include <cmath>
int main()
{ double radius, area;
//Get the radius from the user
cout << "enter the radius of the circle: ";
cin >> radius;
Code
#include <iostream>
#include <iomanip>
int main() {
// Print the header
std::cout << std::setw(5) << "Dec" << std::setw(5) << "Char" << std::setw(5)
<< "Hex" << std::setw(5) << "Oct" << std::endl;
int main() {
int n = 20;
cout << "n = " << n << endl;
return 0;
}