Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem statement: You are tasked with writing a program which will write a mont

ID: 3773251 • Letter: P

Question

Problem statement: You are tasked with writing a program which will write a monthly account summary of customers' transactions at the bank at which you are employed.The monthly transactions are stored in a file called transactions.txt in the follow form: 123 d45.10 d50.45 d198.56 w45.67 The first entry is the account number; the remainder of the line, variable in length, contains all the transactions of the particular customer for the month: If the entry begins with a d, the number that follows is the amount of deposit If it begins with a w, the number that follows is the amount of withdraw. The customer "database" is stored in another file, accounts.txt which has entries of the form 123 daffy 34.67 where each line contains the customer's account number then their name, followed by the current account balance at the beginning of the month. Your program will write report in the following form ( given the above data ) Account Number 123 Name daffy Beginning Balance : $34.67 Ending Balance : $283.11 Amount Deposited : $294.11 Number of Deposits : 3 Amount Withdrawn : $45.67 Number of Withdraw 1 The report is to be written to a file called account_report_MONTH.txt, where MONTH is a user entered month name CODE: Your program will read from the following files: a file containing the listing of all transactions for the month; a file containing a list of all customers, along with their account ids. You must use the following structure to hold the data of each customer: struct PersonAcct // struct account holds customer info { int acct_num; // customer account number string name; // customers name int acct_bal; // customers account balance } Here are the two text files: accounts.txt 123 daffy 34.67 345 goofy 123.89 639 sneezy 1945.76 890 dopey 12345667.90 666 grumpy 666.66 transactions.txt 123 d45.10 d50.45 d198.56 w45.67 345 w34.00 d4.56 w45.13 d23.23 w23.12 639 d1000.34 d1234.56 w34.33 w345.87 w22.13 890 d345.67 d123.67 d45.99 d45.99 w34.77 666 d66.60 d666.66 d6.66 d66.6 d6666.66 Using visual studio c++. Also note to anyhelp out there if you do not have screen shot of your code output. Do not attempt to answer this question. There are lots of so call folks that are answering wrongly.

Please note do not answer this question if you do not undertand it .The output should have the user enter an account number like 123, then the name like Daffy and the rest of the information should appear.

Explanation / Answer

writing a program which will write a monthly account summary of customers' transactions:

Ans) program:

import java.io.*;

class Curr_acct
{
final int max_limit=20;
final int min_limit=1;
final double min_bal=500;
private String name[]=new String[20];
privateint accNo[]=newint[20];
private String accType[]=new String[20];
privatedouble balAmt[]=newdouble[20];
staticint totRec=0;
  
{
for(int i=0;i<max_limit;i++)
{
name[i]="daffy";
accNo[i]=123;
accType[i]="";
balAmt[i]=$34.67;
}
}

  
  
//TO ADD NEW RECORDpublicvoid newEntry()
{
String str;
int acno;
double amt;
boolean permit;
permit=true;

if (totRec>max_limit)
{
System.out.println(" Sorry we cannot admit you in our bank... ");
permit=false;
}

if(permit = true) //Allows to create new entry
{
totRec++; // Incrementing Total Record   
System.out.println(" =====RECORDING NEW ENTRY=====");
try{
accNo[totRec]=totRec; //Created AutoNumber to accNo so no invalid id occurs
System.out.println("Account Number : "+accNo[totRec]);
  
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Name : ");
System.out.flush();
name[totRec]=obj.readLine();

accType[totRec]="Current Account";
System.out.println("Account Type : "+accType[totRec]);   

do{
System.out.print("Enter Initial Amount to be deposited : ");
System.out.flush();
str=obj.readLine();
balAmt[totRec]=Double.parseDouble(str);
}while(balAmt[totRec]<min_bal); //Validation that minimun amount must be 500

System.out.println(" ");
}
catch(Exception e)
{}
}
}

  
  
//TO DISPLAY DETAILS OF RECORDpublicvoid display()
{
String str;
int acno=123;
boolean valid=true;

System.out.println(" =====DISPLAYING DETAILS OF CUSTOMER===== ");
try{
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Account number : ");
System.out.flush();
str=obj.readLine();
acno=Integer.parseInt(str);
if (acno<min_limit || acno>totRec) //To check whether accNo is valid or Not
{
System.out.println(" Invalid Account Number ");
valid=false;
}

if (valid==true)
{   
System.out.println(" Account Number : "+accNo[acno]);
System.out.println("Name : "+name[acno]);
System.out.println("Account Type : "+accType[acno]);
System.out.println("Balance Amount : "+balAmt[acno]+" ");
}
}
catch(Exception e)
{}
}

//TO DEPOSIT AN AMOUNTpublicvoid deposit()
{
String str;
double amt;
int acno;
boolean valid=true;
System.out.println(" =====DEPOSIT AMOUNT==");
  
try{
//Reading deposit value
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter Account No : ");
System.out.flush();
str=obj.readLine();
acno=Integer.parseInt(str);
if (acno<min_limit || acno>totRec) //To check whether accNo is valid or Not
{
System.out.println(" Invalid Account Number ");
valid=false;
}

if (valid==true)
{
System.out.print("Enter Amount you want to Deposit : ");
System.out.flush();
str=obj.readLine();
amt=Double.parseDouble(str);

balAmt[acno]=balAmt[acno]+amt;

//Displaying Depsit Details
System.out.println(" After Updation...");
System.out.println("Account Number : "+acno);
System.out.println("Balance Amount : "+balAmt[acno]+" ");
}
}
catch(Exception e)
{}
}


//TO WITHDRAW BALANCEpublicvoid withdraw()
{
String str;
double amt,checkamt,penalty;
int acno;
boolean valid=true;
System.out.println(" =====WITHDRAW AMOUNT=====");
  
try{
//Reading deposit value
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter Account No : ");
System.out.flush();
str=obj.readLine();
acno=Integer.parseInt(str);

if (acno<min_limit || acno>totRec) //To check whether accNo is valid or Not
{
System.out.println(" Invalid Account Number ");
valid=false;
}

if (valid==true)
{
System.out.println("Balance is : "+balAmt[$283.11]);
System.out.print("Enter Amount you want to withdraw :$45.67 ");
System.out.flush();
str=obj.readLine();
amt=Double.parseDouble(str);

checkamt=balAmt[acno]-amt;

if(checkamt >= min_bal)
{
balAmt[acno]=checkamt;
//Displaying Depsit Details
System.out.println(" After Updation...");
System.out.println("Account Number : "+acno);
System.out.println("Balance Amount : "+balAmt[acno]+" ");
}
else
{
System.out.println(" Your Balance has gone down and so penalty is calculated");
  

penalty=((min_bal - checkamt)*20)/100;
balAmt[acno]=balAmt[acno]-(amt+penalty);
System.out.println("Now your balance revels : "+balAmt[acno]+" ");
}
}
}
catch(Exception e)
{}
}

}

class Sav_acct //SAVING ACCOUNT CLASS
{
final int max_limit=20;
final int min_limit=1;
final double min_bal=500;
private String name[]=new String[20];
privateint accNo[]=newint[20];
private String accType[]=new String[20];
privatedouble balAmt[]=newdouble[20];
staticint totRec=0;
  
//Intializing Methodpublicvoid initialize()
{
for(int i=0;i<max_limit;i++)
{
name[i]="";
accNo[i]=0;
accType[i]="";
balAmt[i]=0.0;
}
}

  
  
//TO ADD NEW RECORDpublicvoid newEntry()
{
String str;
int acno;
double amt;
boolean permit;
permit=true;

if (totRec>max_limit)
{
System.out.println(" Sorry we cannot admit you in our bank... ");
permit=false;
}

if(permit = true) //Allows to create new entry
{
totRec++; // Incrementing Total Record   
System.out.println(" =====RECORDING NEW ENTRY=====");
try{
accNo[totRec]=totRec; //Created AutoNumber to accNo so no invalid id occurs
System.out.println("Account Number : "+accNo[totRec]);
  
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Name : ");
System.out.flush();
name[totRec]=obj.readLine();

accType[totRec]="Saving Account";   
System.out.println("Account Type : "+accType[totRec]);

do{
System.out.print("Enter Initial Amount to be deposited :$294.11 ");
System.out.flush();
str=obj.readLine();
balAmt[totRec]=Double.parseDouble(str);
}while(balAmt[totRec]<min_bal); //Validation that minimun amount must be 500

System.out.println(" ");
}
catch(Exception e)
{}
}
}

  
  
//TO DISPLAY DETAILS OF RECORDpublicvoid display()
{
String str;
int acno=0;
boolean valid=true;

System.out.println(" =====DISPLAYING DETAILS OF CUSTOMER===== ");
try{
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Account number : ");
System.out.flush();
str=obj.readLine();
acno=Integer.parseInt(str);
if (acno<min_limit || acno>totRec) //To check whether accNo is valid or Not
{
System.out.println(" Invalid Account Number ");
valid=false;
}

if (valid==true)
{   
System.out.println(" Account Number : "+accNo[acno]);
System.out.println("Name : "+name[acno]);
System.out.println("Account Type : "+accType[acno]);
  
//Bank policy is to give 10% interest on Net balance amt
balAmt[acno]=balAmt[acno]+(balAmt[acno]/10);
System.out.println("Balance Amount : "+balAmt[acno]+" ");
}
}
catch(Exception e)
{}
}

//TO DEPOSIT AN AMOUNTpublicvoid deposit()
{
String str;
double amt;
int acno;
boolean valid=true;
System.out.println(" =====DEPOSIT AMOUNT=====");
  
try{
//Reading deposit value
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter Account No : ");
System.out.flush();
str=obj.readLine();
acno=Integer.parseInt(str);
if (acno<min_limit || acno>totRec) //To check whether accNo is valid or Not
{
System.out.println(" Invalid Account Number ");
valid=false;
}

if (valid==true)
{
System.out.print("Enter Amount you want to Deposit : ");
System.out.flush();
str=obj.readLine();
amt=Double.parseDouble(str);

balAmt[acno]=balAmt[acno]+amt;

//Displaying Depsit Details
System.out.println(" After Updation...");
System.out.println("Account Number : "+acno);
System.out.println("Balance Amount : "+balAmt[acno]+" ");
}
}
catch(Exception e)
{}
}

//TO WITHDRAW BALANCEpublicvoid withdraw()
{
String str;
double amt,checkamt;
int acno;
boolean valid=true;
System.out.println(" =====WITHDRAW AMOUNT=====");
  
try{
//Reading deposit value
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter Account No : ");
System.out.flush();
str=obj.readLine();
acno=Integer.parseInt(str);

if (acno<min_limit || acno>totRec) //To check whether accNo is valid or Not
{
System.out.println(" Invalid Account Number ");
valid=false;
}

if (valid==true)
{
System.out.println("Balance is : "+balAmt[acno]);
System.out.print("Enter Amount you want to withdraw : ");
System.out.flush();
str=obj.readLine();
amt=Double.parseDouble(str);

checkamt=balAmt[acno]-amt;

if(checkamt >= min_bal)
{
balAmt[acno]=checkamt;
//Displaying Depsit Details
System.out.println(" After Updation...");
System.out.println("Account Number : "+acno);
System.out.println("Balance Amount : "+balAmt[acno]+" ");
}
else
{
System.out.println(" As per Bank Rule you should maintain minimum balance of Rs

500 ");
}
}
}
catch(Exception e)
{}
}
}

class Bank_improved
{
publicstaticvoid main(String args[])
{
String str;
int choice,check_acct=1,quit=0;
choice=0;

Curr_acct curr_obj = new Curr_acct();
Sav_acct sav_obj = new Sav_acct();

System.out.println(" =====WELLCOME TO BANK DEMO PROJECT===== ");


while( quit!=1)
{
try{
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Type 1 for Current Account and Any no for Saving Account : ");
System.out.flush();
str=obj.readLine();
check_acct=Integer.parseInt(str);
}
catch(Exception e) {}

if(check_acct==1)
{
do//For Current Account
{
System.out.println(" Choose Your Choices ...");
System.out.println("1) New Record Entry ");
System.out.println("2) Display Record Details ");
System.out.println("3) Deposit...");
System.out.println("4) Withdraw...");
System.out.println("5) Quit");
System.out.print("Enter your choice : ");
System.out.flush();
try{
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
str=obj.readLine();
choice=Integer.parseInt(str);

switch(choice)
{
case 1 : //New Record Entry
curr_obj.newEntry();
break;
case 2 : //Displaying Record Details
curr_obj.display();
break;
case 3 : //Deposit...
curr_obj.deposit();
break;
case 4 : //Withdraw...
curr_obj.withdraw();
break;
case 5 : System.out.println(" .....Closing Current Account.....");
break;
default : System.out.println(" Invalid Choice ");
}
}
catch(Exception e)
{}
}while(choice!=5);
}
else
{
do//For Saving Account
{
System.out.println("Choose Your Choices ...");
System.out.println("1) New Record Entry ");
System.out.println("2) Display Record Details ");
System.out.println("3) Deposit...");
System.out.println("4) Withdraw...");
System.out.println("5) Quit");
System.out.print("Enter your choice : ");
System.out.flush();
try{
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
str=obj.readLine();
choice=Integer.parseInt(str);

switch(choice)
{
case 1 : //New Record Entry
sav_obj.newEntry();
break;
case 2 : //Displaying Record Details
sav_obj.display();
break;
case 3 : //Deposit...
sav_obj.deposit();
break;
case 4 : //Withdraw...
sav_obj.withdraw();
break;
case 5 : System.out.println(" .....Closing Saving Account.....");
break;
default : System.out.println(" Invalid Choice ");
}
}
catch(Exception e)
{}
}while(choice!=5);
}

try{
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
System.out.print(" Enter 1 for Exit : ");
System.out.flush();
str=obj.readLine();
quit=Integer.parseInt(str);
}catch (Exception e){}
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote