Hello, I would like someone to help me with this assignment. Is it possible that
ID: 3735510 • Letter: H
Question
Hello, I would like someone to help me with this assignment. Is it possible that someone can email and walk me through completing this?
Create an application for the Credit Card service that allow users can do the following tasks CREDIT CARD SERVICE MENU 1. Open new credit card 2. Onetransaction 3. Print statement 4. Payment 5. Get Available credit amount 6. Get Interest rate After finishing one task, redisplay the menu to allow users to select other tasks until they want to exit Each credit card account will hold the following information: name (String), card number (String), SS number (String), phone number (String), address (String), username (String), password (String), credit line (double $2000) available credit (double, start with credit line amount), current balance (double), minimum balance (double), interest rate (double) Also, the credit card account will provide the information for all the tasks listed on the menu TASK 1: Open new credit card Ask users to enter the information: name, SS numbers, phone number, address, username, password to create the new credit card account -display the message Credit Card is available for you. Name Card number: Credit Line: Available Credit: Current Balance: Interest Rate: Minimum payment amount Due: James Smith 2438371220124047 2000.0 2000.0 16.99% Where the credit card number is a numeric string with 16 digits that is combined from 4 random 4-digit numbers (to learn how to generate a random numbers read the topic GENERATE RANDOM NUMBERS from the Learn From Questions on eCampus Available credit is $2000 that is assigned for each beginning account Interest rate is currently set to 16.99% TASK 2: One transactionExplanation / Answer
#include<iostream>
#include<string>
#include <ctime>
using namespace std;
struct Credit
{
std::string name;
std::string ss;
std::string pn[10];
std::string add;
std::string usn[20];
std::string pwd[20];
std::string cardn;
float cred_line;
float ava_cred;
float cred_bal;
float min_bal;
float int_rate;
std::string filen;
char* dt;
float amount;
};
int main()
{
Credit * pointer = new Credit[50];
std::string user;
std::string pass;
int op;
int i=0;//max 50 users.you can change this accordingly
while (true)
{
cout<<"1.Open new credit card"<<" ";
cout<<"2.One transaction"<<" ";
cout<<"3.Print Statement"<<" ";
cout<<"4.Payment"<<" ";
cout<<"5.get available credit card amount"<<" ";
cout<<"6.Get interest"<<" ";
cout<<"7.exit program"<<" ";
cout<<"Enter choice?"<<" ";
cin>>op;
int r1,r2,r3,r4,i=0,j;
switch(op)
{
case 1:
cout<<"enter name"<<" ";
getline(cin,pointer[i].name);
cout<<"SS numbers"<<" ";
getline(cin,pointer[i].ss);
cout<<"phone number"<<" ";
getline(cin,pointer[i].pn);
cout<<"address"<<" ";
getline(cin,pointer[i].add);
cout<<"user name"<<" ";
getline(cin,pointer[i].usn);
cout<<"enter password"<<" ";
getline(cin,pointer[i].pwd);
srand(time(NULL));//generating random numbers for credit card
r1=rand() % (9999 - 1000) + 1000;
cardn = std::to_string(r1);
r2=rand() % (9999 - 1000) + 1000;
cardn = cardn+std::to_string(r2);
r3=rand() % (9999 - 1000) + 1000;
cardn = cardn+std::to_string(r3);
r4=rand() % (9999 - 1000) + 1000;
cardn = cardn+std::to_string(r4);
pointer[i].filen="_"+cardn+"txt";
cout<<"Credit card is available for you"<<" ";
cout<<"name"<<" "<<name<<" ";
cout<<"credit card number"<<" "<<cardn<<" ";
pointer[i].cred_line=2000;
cout<<"credit line"<<" "<<"2000"<<" ";
pointer[i].ava_cred=2000
cout<<"available credit"<<" "<<"2000"<<" ";
pointer[i].cred_bal=0.0;
cout<<"credit balance"<<" "<<"0.0"<<" ";
pointer[i].int_rate=16.9;
cout<<"interest rate"<<" "<<"16.9"<<" ";
cout<<"minimum payment amount due"<<" "<<"0.0"<<" ";
i++;
break;
case 2:
std::fstream fs;
std::string type;
std::string des;
float amt;
cout<<"enter user name";
getline(cin,user);
cout<<"enter password";
getline(cin,pass);
for(j=0;j<i;j++)
{
if(user==pointer[j].usn)//overloaded ==
{
if(pass==pointer[j].pwd)
c=1;
break;
}
}
if(c==1)
{
cout<<"enter description";
getline(cin,des);
cout<<"enter the type of transaction";
getline(cin,type);
cout<<"enter amount ";
cin>>amt;
if(pointer[j].ava_cred>amt)
{
pointer[i].cur_bal=pointer[i].cur_bal+amt;
pointer[i].ava_cred=pointer[i].ava_cred-amt;
fs.open(pointer[j].filen,std::fstream::in | std::fstream::out | std::fstream::app);
time_t now = time(0); //calculating the curent date and time
char* dte = ctime(&now);
pointer[j].dt=dte;
pointer[j].amount=amt;
fs<<endl;
fs<<dt<<" ";
fs<<des<<" ";
fs<<type<<" ";
fs<<amt<<" ";
fs.close();
}
else
cout<<"Transaction is denied";<<endl;
}
else
cout<<"invalid ID password";
break;
case 3:
fstream fs;
cout<<"enter user name";
getline(cin,user);
cout<<"enter password";
getline(cin,pass);
for(j=0;j<i;j++)
{
if(user==pointer[j].usn)//overloaded ==
{
if(pass==pointer[j].pwd)
c=1;
break;
}
}
if(c==1)
{
cout<<"credit card statement";
cout<<"name"<<pointer[j].name<<endl;
cout<<"credit card number"<<pointer[j].credn<<endl;
cout<<"credit line"<<pointer[j].cred_line<<endl;
cout<<"available credit"<<pointer[j].ava_cred<<endl;
cout<<"current balance"<<pointer[j].cur_bal<<endl;
cout<<"interest rate"<<pointer[j].int_rate<<endl;
cout<<"minimum payment amount due"<<pointer[j].amount<<endl;
cout<<"Payment due date"<<pointer[j].dt<<endl;
fs.open(pointer[j].filen,std::fstream::in | std::fstream::out | std::fstream::app);
char* date;
std::string des;
std::string type;
float amt;
while(!fs.eof())
{
fs>>date;
fs>>des;
fs>>type;
fs>>amt;
cout<<date<<" "<<des<<" "<<type<<" "<<amt<<" ";
}
fs.close();
fs.open(pointer[j].filen)//open to make file empty for new period
fs<<"";
fs.close();
}
else
cout<<"invalid ID password";
break;
case 4:
float amt;
cout<<"enter user name";
getline(cin,user);
cout<<"enter password";
getline(cin,pass);
for(j=0;j<i;j++)
{
if(user==pointer[j].usn)//overloaded ==
{
if(pass==pointer[j].pwd)
c=1;
break;
}
}
if(c==1)
{
cout<<"enter payment amount"<<endl;
cin>>amt;
if(pointer[j].ava_cred>amt)
{
pointer[i].cur_bal=pointer[i].cur_bal+amt;
pointer[i].ava_cred=pointer[i].ava_cred-amt;
if(pointer[j].cur_bal>0)
{
float int_amt=pointer[j].cur_bal*pointer[j].int_rate;
pointer[j].cur_bal=pointer[j].cur_bal+int_amt;
pointer[j].ava_cred=pointer[j].cred_line-pointer[j].cur_bal;
}
}
else
cout<<"Transaction is denied";<<endl;
}
else
cout<<"invalid ID password";
break;
case 5:
cout<<"enter user name";
getline(cin,user);
cout<<"enter password";
getline(cin,pass);
for(j=0;j<i;j++)
{
if(user==pointer[j].usn)//overloaded ==
{
if(pass==pointer[j].pwd)
c=1;
break;
}
}
if(c==1)
{
cout<<"current available credit amount:"<<" "<<pointer[j].ava_cred;
}
else
cout<<"invalid ID password";
break;
case 6:
cout<<"enter user name";
getline(cin,user);
cout<<"enter password";
getline(cin,pass);
for(j=0;j<i;j++)
{
if(user==pointer[j].usn)//overloaded ==
{
if(pass==pointer[j].pwd)
c=1;
break;
}
}
if(c==1)
{
cout<<"current interest rate:"<<" "<<pointer[j].int_rate;
}
else
cout<<"invalid ID password";
break;
case 7:
exit(0);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.