
ans........................................................................................................................
#include<iostream>
#include<fstream>
#include<cstdlib>
using namespace std;
void display_options()
{
printf("\n1. Create account \n");
printf("2. Log in \n");
printf("3. Exit \n\n");
printf("Please enter : ");
}
void display_T()
{
printf("\n1. Withdraw\n");
printf("2. Deposite \n");
printf("3. View balance ");
printf("4. Exit\n\n : ");
printf("Please Enter : ");
}
struct account
{
int accountnumber;
string name;
string password;
int balance;
};
account A[1000];
int n=0;
int generateaccountnumber()
{
int r;
while(true)
{
r=rand()%10000;
bool flag=false;
for(int i=0 ;i<n; i++)
{
if(A[i].accountnumber==r)
{
flag=true;
break;
}
}
if(flag==false)
return r;
}
}
int checkaccount(int number,string password)
{
for(int i=0; i<n; i++)
{
if(A[i].accountnumber==number && A[i].password==password)
return i;
}
return -1;
}
int main()
{
char option;
int num_acc=0;
ifstream infile("Vishal_bank.txt");
if (!infile.is_open())
{
cout<<"Error to open file.";
return 0;
}
int number;
string name;
string password;
int balance;
while (infile >> number >> name >> password>>balance)
{
A[n].accountnumber=number;
A[n].name=name;
A[n].password=password;
A[n].balance=balance;
n=n+1;
}
infile.close();
while(1)
{
printf("\n**** Welcome to Bank Application ****\n");
display_options();
cin>>option;
printf("%c \n", option);
int temp;
switch(option)
{
case '1': number=generateaccountnumber();
cout<<"enter name: ";
cin>>name;
cout<<"enter password: ";
cin>>password;
A[n].accountnumber=number;
A[n].name=name;
A[n].password=password;
A[n].balance=50;
cout<<"your new account number is :" <<number<<endl;
n=n+1;
break;
case '2': cout<<"enter account number: ";
cin>>number;
cout<<"enter password: ";
cin>>password;
temp=checkaccount(number,password);
if(temp!=-1)
{
while(true)
{
display_T();
cin>>option;
int money;
switch(option)
{
case '1':cout<<"Enter money : ";
cin>>money;
if(money==-1)
break;
else
while(money<-1)
{
cout<<"Enter valid money."<<endl;
cin>>money;
}
if(A[temp].balance-money<0)
cout<<"can't withdrawl"<<endl;
else
A[temp].balance=A[temp].balance-money;
break;
case'2':
cout<<"Enter money : ";
cin>>money;
if(money==-1)
break;
else
while(money<-1)
{
cout<<"Enter valid money."<<endl;
cin>>money;
}
A[temp].balance=A[temp].balance+money;
break;
case 3:
cout<<"Balance"<<A[temp].balance<<endl;
break;
case 4:
break;
default:
cout<<"Wrong choice";
}
}
}
else
{
cout<<"Wrong details"<<endl;
}
break;
case '3': exit(0);
break;
default : system("cls");
printf("Please enter one of the options");
printf("(1/2/3) to continue \n ");
break;
}
}
return 0;
}
C++ Read and do as instructed on please (C++Program *** use only condition statements, loops, functions,...
In Java, please write the program for the following program.
Please TEST YOUR PROGRAM. You MUST use GUI, that means all user
input must be through the windows. The "first window" is the window
on the top left of the following picture. Add 5 more items to be
purchased. Search is accessed from second window, top right. Thw
third window is the bottom left, and the fourth window is the
bottom right. The program MUST CONTAIN EVERYTHING IN THE PICTURES....
Please Read it all and carefully In visual basic(vba)do the following program Summary INGE Industry, Inc. needs a program in which the date and temperature in Celsius degrees of an industry laboratory are recorded and stored in a sequential file. In addition, you can see the recorded data and convert the temperatures in the following units: Fahrenheit, Kelvin and Rankine. In addition, they want to see a linear graph that reflects how the temperature has fluctuated day by day, for...
I have to use java programs using netbeans. this
course is introduction to java programming so i have to write it in
a simple way using till chapter 6 (arrays) you can use (loops ,
methods , arrays)
You will implement a menu-based system for Hangman Game. Hangman is a popular game that allows one player to choose a word and another player to guess it one letter at a time. Implement your system to perform the following tasks: Design...
Using Python
INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user login system. Your code should do the following: 3, create-user_name() #use this function to create the user name 1.Create your user database called "UD.txt", this should be in CSV format 4, write-file() #user this function to save the user name and password into "UD.txt" Deliverables: Sample: the data you saved...
Please i need the .H, .cpp and main.cpp files. Please use vector. its for my midterm so correct code that can run only. Thank you. Pointers and Dynamic Memory – Chapter 11 1. Write code using pointers and the Accounts class from week 1 assignment as follows – create a program in which you a. Create 10 accounts using an array with id’s 0 to 9 and refer to each account using pointer notation b. Add an initial balance of...
Please do this in C++ using only for loops, while loops, and do
while loops. No arrays.
Use for loop, while loop, and do while loops to generate a table of decimal numbers, as well as the binary, octal, and hexadecimal equivalents of the decimal numbers in the range 1-256 Note: See Appendix for number systems The program should print the results to the Console without using any string formats Design Details: The Main program should prompt the user for...
In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops for the input validations required: number of employees(cannot be less than 1) and number of days any employee missed(cannot be a negative number, 0 is valid.) Each function needs a separate flowchart. The function charts are not connected to main with flowlines. main will have the usual start and end symbols. The other three functions should indicate the parameters, if any, in start; and...
Please, please help with C program.
This is a longer program, so take your time. But please make
sure it meets all the requirements and runs.
Here is the assignment:
I appreciate any help given.
Cannot use goto or system(3) function unless directed to.
In this exercise you are to create a database of dogs in a file, using open, close(), read, write(), and Iseek(). Do NOT use the standard library fopen() ... calls! Be sure to follow the directions!...
Problem:A small electronics company has hired you to write an application to manage their inventory. The company requested a role-based access control (RBAC) to increase the security around using the new application. The company also requested that the application menu must be flexible enough to allow adding new menu items to the menu with minimal changes. This includes re-ordering the menu items and making changes to the description of a menu item without having to change the code.Security:The company has...
Please help me the JAVA program - Choose Your Operation
Write a program that uses a WidgetView object to do the following: Generate two random integers between 1 and 9 (inclusive). Name one of them x, the other y. Display them to the user using JLabel objects. Create a JLabel object displaying the text "Enter an operation number." Create a JTextField for the user's input. Create a JButton displaying the text "Press here when you've entered your operation." Use addAndWait...