View the step-by-step solution to:

I am working on a project, and I am having an issues with the codes. Thank you. /** * @(#)Transactions.

I am working on a project, and I am having an issues with the codes. I would really appreciate if anybody can help me fixing the codes to run the program smoothly.

Thank you.





/**

 * @(#)Transactions.java

 *

 * Transactions application

 *

 

 * @version 1.00 2018/12/2

 */

import java.util.Scanner;

public class Transactions {


   public static void main(String[] args) {


   BankAcc obj1=new BankAcc("NAIM","NA0001");

   obj1.showMenu();

   }

}


class BankAcc

{


   int balance;

   int previousTrans;

   String customerName;

   String customerID;



   BankAcc(String cname,String cid)

   {

      customerName=cname

      customerID=cid;


   }


   void deposit(int amount);

   {


      if (amount!=0)

      {

      balance=balance+amount;

      previousTrans=amount;


      }

   }

   void withdrawal(int amount)

   {

      if (amount >=0)

      {

      balance = balance-amount;

      previousTrans=-amount;

      }

   }

   void getpreviousTrans()

   {


      System.out.println("Deposited: "+previousTrans);


   }

      else if(previousTrans<0)

{

     System.out.println("Withdrawal: "+Math.abs(previousTrans));

}

      else

{

    System.out.println("NO TRANSACTION TOOK PLACE");

}

}

 void showMenu()

 {



    char option='';

    Scanner scanner = new Scanner(System.in);


    System.out.println("WELCOME "+CustomerName);

    System.out.println("YOUR ID "+CustomerID);

    System.out.println("n");

    System.out.println("A. CHECK BALANCE");

    System.out.println("B. DEPOSIT);

    System.out.println("C. WITHDRAWAL);

    System.out.println("D. PREVIOUS TRASACTION);

    System.out.println("E. EXIT);



    do

    {

       System.out.println("===============================================================")

       System.out.println("ENTER AN OPTION");

       System.out.println("===============================================================")

       option=scanner.next().charAt(0);

       System.out.println("n");


       switch(option)

       {


       case 'A':

          System.out.println("==============================");

          System.out.println("Balance ="+balance);

          System.out.println("==============================");

          System.out.println("n");

          break;


       case 'B':

          System.out.println("==============================");

          System.out.println("ENTER AN AMOUNT TO DEPOSIT");

          System.out.println("==============================");

          int amount = scanner.nextInt();

          deposit(amount);

          System.out.println("n");

          break;


       case 'C':

          System.out.println("==============================");

          System.out.println("ENTER AN WITHDRAWAL AMOUNT");

          System.out.println("==============================");

          int amount2 = scanner.nextInt();

          withdrawal(amount2);

          System.out.println("n");

          break;


       case 'D':

          System.out.println("==============================");

          getpreviousTrans();

          System.out.println("==============================");

          System.out.println("n");

          break;


       case 'E':

          System.out.println("*******************************");

          break;


          default:

           System.out.println("INVALID CHOICE!!. PLEASE ENTER AGAIN");

           break;


       }

    }while(option != 'E');


    System.out.println("THANK YOU");


 }

}

Top Answer

Correction 1 : Terminate the statement by using a semicolon.     BankAcc( String cname, String cid) {        ... View the full answer

BacnkAcc-1.PNG

1 comment
  • public class BankAcc { ................................ it's showing error in this line - kindly help me !!
    • Whozayne
    • Dec 03, 2018 at 9:14am

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online