Can anyone please help code this in C version and not in Jav

Can anyone please help code this in C++ version and not in Java. Thank you

Simulate an ATM machine.

(a) The system should show the following top menu. Write a function that simply displays this menu. 1. Sign in 2. Balance 3. Deposit 4. Withdraw 5. Exit (b) We assume that this ATM machine holds account for only 10 people. So, use an array to store client’s account balance. Suppose all accounts start with an initial balance of $1000. With this structure in mind we use array indices (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) as user’s account number (a single digit) and array values as balances. The user must first sign in to use the machine by entering their account number (0, 1, 2, 3,.. 9). If the user attempts to use the system without signing in, or enters an incorrect account number the system should give a warning message and display the menu again. (c) User can request account Balance by entering option 2. Write a function to complete the following task: The system displays the current balance. If balance is below $100, the system should display the message “Low Balance” then go back to the top menu. (d) If option menu 3, which is Deposit is selected, write a function to compete the task: the system should prompt the user to enter the amount. The ATM machine validates the input by verifying that the input is positive. If not a warning message is displayed “invalid amount”, and the user is prompted to try again, if amount is negative again, the deposit operation is terminated and the top menu is displayed again. If amount is positive the Balance is updated. (e) If option 4, which is Withdraw is selected, write a function to compete the task: the ATM machine prompts the user to enter amount, then checks if user has sufficient Balance. If the balance is insufficient, then a warning message along with user’s balance is displayed. The user is prompted to enter a new amount for a second time, if amount is OK withdraw operation is completed and balance is updated and menu is displayed. If balance is still insufficient withdraw operation is terminated and top menu is displayed. (f) For option exit write will a function that display a “Good Bye” message and exits/log out from user’s account. The ATM machine’s menu is displayed, however this time the next user must sign in.

Solution

ANS:

#include<iostream>
using namespace std;
class Atm
{
private: int a[10];//amount array
   int amount,count;
public :Atm(){//constructor
for(int i=0;i<10;i++)
a[i]=1000;//initial deposit

}
void checkbalance(int a_no){
cout<<\"\ BALANCE: =\"<<a[a_no];
if(a[a_no]<=100)
cout<<\"\ Low Balance\";
}//end of checkbalance
void deposit(int a_no)
{
count=0;
neg:count++;
cout<<\"\ enter amount\";
cin>>amount;
if(amount<=0)
{
if(count==2)
{
cout<<\"\ Ivalid amount\" ;
}
else
{
cout<<\"\ Invalid amount,Try again\";
goto neg;
}
}
else
{
a[a_no]=a[a_no]+amount;
cout<<\"\ Deposited Successfuly\";
}

}
void withdraw(int a_no)
{
count=0;
neg:count++;
cout<<\"\ enter amount\";
cin>>amount;
if(amount<=0)
{
if(count==2)
cout<<\"\ invalid amount\";
else
{
cout<<\"\ invalid amount,Try again,\";goto neg;
}
}
else if(amount>a[a_no])
{
if(count==2)
{
cout<<\"\ InSufficient amount\" ;
}
else
{
cout<<\"\ InSufficient amount,Try again, Your Balance=\"<<a[a_no];
goto neg;
}
}
else
{
a[a_no]=a[a_no]-amount;
cout<<\"\ withdrawn successfully\";
}

}
void exit(){
cout<<\"\ Good Bye, You are Successfully Logged out\";
}
};
int main()
{
int i,choice,amount,a_no;
int signin=0;
Atm p;
while(1)
{
cout<<\"\ enter 1 for Sign in\ 2.for Balance \ 3 for Deposit\ 4 for Withdraw\ 5 for exit: \";
cin>>choice;
switch(choice)
{
case 1: cout<<\"\ enter account number: \";
   cin>>a_no;
   if(a_no<0 || a_no>=10)
   {
   cout<<\"\ Invalid account number, Try again\";
   }
   else
   {
   signin=1;
   }
   break;
case 2: if(signin==0)
   {
   cout<<\" \ You Should Sign in first to check balance \";
   }
   else
   {
   p.checkbalance(a_no);
   }
break;
case 3: if(signin==0)
   {
   cout<<\"\ IYou Should Signin first to deposit \";
   }
   else
   {
   p.deposit(a_no);
   }
   break;
case 4: if(signin==0)
   {
   cout<<\"\ You Should Signin first to Withdraw \";
   }
   else
   {
   p.withdraw(a_no);
   }
   break;
case 5: if(signin==0)
   {
   cout<<\"\ You Should Signin first to Signout \";
   }
   else
   {
   signin=0;
   p.exit();
   }
   break;
default: cout<<\" \ invalid choice,Try again: \";
}//end of switch
} //end of while
}//end of main

Can anyone please help code this in C++ version and not in Java. Thank you Simulate an ATM machine. (a) The system should show the following top menu. Write a f
Can anyone please help code this in C++ version and not in Java. Thank you Simulate an ATM machine. (a) The system should show the following top menu. Write a f
Can anyone please help code this in C++ version and not in Java. Thank you Simulate an ATM machine. (a) The system should show the following top menu. Write a f

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site