Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

artificial intelligence project. Here is the code and Ali would like to add some lines to create a smarter user-machine interaction. For example, after completing

artificial intelligence project. Here is the code and Ali would like to add some lines to create a smarter user-machine interaction. For example, after completing the process and doing another process, the machine asks, Are you the user x who logged in the previous time, or any other idea to add a touch of artificial intelligence in the code #include #include #include #include double fastcash(double balance); double withdraw(double balance); double deposit(double balance); void checkbalance(double balance); int main() { double balance; int pin = 1234, upin; char ynchoice; int choice, pinCount = 0; int seedVal = 0; time_t t; seedVal = (unsigned)time(&t); srand(seedVal); balance = rand() % (50000 - 20000 + 1) + 20000; printf("\t\tVirtual ATM Bank "); printf("\t\tWELCOME !!! "); printf(" Enter Pin: "); while (1) { scanf("%d", &upin); if (pin == upin) { break; } else { printf("Invalid PIN, Re-enter Pin: "); pinCount++; if (pinCount == 3) { printf(" Sorry you can't continue, contact your bank for assistance!"); exit(0); } continue; } } system("cls"); while (1) { printf(" CHOOSE FROM THE FOLLOWING "); printf("1 -> Fast Cash "); printf("2 -> Withdraw "); printf("3 -> Deposit "); printf("4 -> Check Balance "); printf("5 -> Get Card Back "); printf("Enter your choice:"); scanf("%d", &choice); system("cls"); switch (choice) { case 1: { balance = fastcash(balance); break; } case 2: { balance = withdraw(balance); break; } case 3: { balance = deposit(balance); break; } case 4: { checkbalance(balance); break; } case 5: { printf(" THANK FOR USING OUR VIRTUAL BANK SYSTEM"); printf(" GOODBYE. . ."); exit(0); } } printf(" 1 -> Another Transaction\t\tGet Card Back <- 2 "); scanf("%d", &choice); if (choice == 1) { system("cls"); continue; } else if (choice == 2) { printf(" THANK FOR USING OUR VIRTUAL BANK SYSTEM"); printf(" GOODBYE. . ."); break; } } return 0; } double fastcash(double balance) { int choice; while (1) { printf(" Press:"); printf("\t1 --> $20.00\t\t\t$40.00 <-- 2 "); printf("\t3 --> $80.00\t\t\t$100.00 <-- 4 "); scanf("%d", &choice); if (choice == 1) { printf("Take your cash...$20.00"); balance = balance - 20; break; } else if (choice == 2) { printf("Take your cash...$40.00"); balance = balance - 40; break; } else if (choice == 3) { printf("Take your cash...$80.00"); balance = balance - 80; break; } else if (choice == 4) { printf("Take your cash...$100.00"); balance = balance - 100; break; } else { printf(":: Invalid Button Pressed ::"); continue; } } return balance; } double withdraw(double balance) { double amt; while (1) { printf(" Enter amount (enter 0 to cancel):"); scanf("%lf", &amt); if (amt == 0) { return balance; } else if (amt > balance) { printf(" Sorry not enough balance"); } else if (amt < balance) { balance = balance - amt; break; } } printf(" Take your cash... %.2lf", amt); return balance; } double deposit(double balance) { double amt; printf(" Enter deposit amount :$"); scanf("%lf", &amt); balance += amt; return balance; } void checkbalance(double balance) { printf(" Your balance is $%.2f", balance); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions