Question

Need help in trying to get my java program to work, Its finished but i still...

Need help in trying to get my java program to work, Its finished but i still have errors left when i compile

WHy do i get this error message"Illegal start of expression void displaysummary() " When i try to complie my java program ?


import java.io.*;
  
public class prog23
{
   public static void main(String[] args) throws I0Exception
   {
       program23 app = new program23();
       app.appMain();
   }
}
class program23
{
  
   BufferedReader stdin;

       int custNum;
       float begBal, overDraft;
       String monthEnd;
      
       int transNum;
       char transType;
       String transDate, overPenalty;
       float transAmt;
      
       float runBal, totCredits, totDebits, totOverAmt;
       int creditTransCtr, lowDebitNum;
       float lowDebitAmt, avgCredit;
      
void appMain() throws I0Exception
{
       reportHeader();
       initReport();
       getAccountInfo();
       initRunningBal();
      
       while (transNum != 0)
       {  
               procTrans();
       }
       calculateAverage();
       displaySummary();
}

void reportHeader()
{

   System.out.print("******************************************\n");
   System.out.println("Program 23 Solution");
  
  
   System.out.println("******************************************\n");
}

void initReport()
{
      
       stdin = new BufferedReader(new InputStreamReader(System.in));
      
       totCredits = 0;
       totDebits = 0;
       creditTransCtr = 0;
       totOverAmt = 0;
       lowDebitAmt = 5001;
       transNum = -11;
}
void getAccountInfo() throws I0Exception
{
       System.out.print("Please enter the account number: ");
       custNum = Integer.parseInt(stdin.readLine());
      
       System.out.print("Please enter the beginning balance for the account: ");
       begBal = Float.parseFloat(stdin.readLine());
      
       System.out.print("Please enter the month end date for this cycle: ");
       monthEnd = stdin.readLine();
      
       System.out.print("Please enter the overdraft penalty amount: ");
       overDraft = Float.parseFloat(stdin.readLine());
}  
      
void initRunningBal()

{
   runBal = begBal;
}

void procTrans() throws I0Exception
{
   getTransNum();
   if (transNum != 0)
   {
           getTransDetails();
           calculateTotalsAndRunBal();
           calculateOverdraftAndPenalty();
           displayTransDetails();
   }
}

void getTransNum() throws I0Exception
{
   System.out.print("\n\nPlease enter the Transaction Number: ");
   transNum = Integer.parseInt(stdin.readLine());
}

void getTransDetails() throws I0Exception
{
       System.out.print("Please enter the Trans Type: ");
       transType = (stdin.readLine().charAt(0));
      
       System.out.print("Please enter the Trans Amount: ");
       transAmt = Float.parseFloat(stdin.readLine());
}

void calculateTotalsAndRunBal()
{
   if (transType == 'C')
   {
           runBal = runBal + transAmt;
           totCredits = totCredits + transAmt;
           creditTransCtr = creditTransCtr + 1;
   }

   if (transType == 'c')
   {
       runBal = runBal + transAmt;
       totCredits = totCredits + transAmt;
       creditTransCtr = creditTransCtr + 1;
   }
  
   if (transType == 'D')
   {
       runBal = runBal - transAmt;
       totDebits = totDebits + transAmt;
       updateLows();
   }
   if (transType == 'd')
   {
           runBal = runBal - transAmt;
           totDebits = totDebits + transAmt;
           updateLows();
   }
}

void calculateOverdraftAndPenalty()
{
   if(runBal < 0)
   {
           runBal = runBal - overDraft;
           totOverAmt = totOverAmt + overDraft;
          
           overPenalty = Float.toString(overDraft);
   {
   else

   {
           overPenalty = "";
   }
}

void updateLows();
{

       if(transAmt < lowDebitAmt)
       {
               lowDebitAmt = transAmt;
               lowDebitNum = transNum;
       }
}

void displayTransDetails();
{
       System.out.println("\n\n\n");
       System.out.println("Customer Transaction:");
       System.out.println( "===========================");
       System.out.println("Transaction #: \t\t" + transNum);
       System.out.println("Transaction Type: \t" + transType);
       System.out.println("Transaction Amt: \t" + transAmt);
       System.out.println("Running Balance: \t" + runBal);
       System.out.println("Over Draft Penalty Amt:\t" + overPenalty);
       System.out.println( "============================");
}

void calculateAverage();
{
       avgCredit = totCredits / creditTransCtr;
}
void displaySummary();
{
       System.out.println("\n\n");
      
       System.out.println("******************************************");  
       System.out.println("****MASCO Monthly Transaction Report Summary****");   
       System.out.println("Customer Account Number: \t\t" + custNum);
       System.out.println("Customer Beginning of Month Balance: \t" + begBal);
       System.out.println("Monthly Transaction Report Ending on: \t" + monthEnd);
       System.out.println("Overdraft Penalty Amount: \t\t" + overDraft);
       System.out.println("******************************************");
       System.out.println("***************************************");
       System.out.println("Customer End Balance:\t" + runBal);
       System.out.println("Total Credits $ Amount:\t" + totCredits);
       System.out.println("Total Debits $ Amount: \t" + totDebits);
       System.out.println("Total Overdraft Amount:\t" + totOverAmt);
       System.out.println("Average Credit Amount: \t" + avgCredit);
       System.out.println();
       System.out.println("Low Debit $ Amount: \t" + lowDebitAmt);
       System.out.println("Low Debit Trans #:\t" + lowDebitNum);
       System.out.println("*******************************");  
       System.out.println("*******************************");  
   }
}

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Need help in trying to get my java program to work, Its finished but i still...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • I need help with my IM (instant messaging) java program, I created the Server, Client, and...

    I need help with my IM (instant messaging) java program, I created the Server, Client, and Message class. I somehow can't get both the server and client to message to each other. I am at a roadblock. Here is the question below. Create an IM (instant messaging) java program so that client and server communicate via serialized objects (e.g. of type Message). Each Message object encapsulates the name of the sender and the response typed by the sender. You may...

  • Explain this java code, please. import java.util.Scanner; public class Program11 { public static void main(String[] args)...

    Explain this java code, please. import java.util.Scanner; public class Program11 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); final int maxSize = 128; String[] titles = new String[maxSize]; int[] lengths = new int[maxSize]; int numDVDs = 0; String op; op = menu(stdIn); System.out.println(); while (!op.equalsIgnoreCase("q")) { if (op.equalsIgnoreCase("a")) { if (numDVDs < maxSize) numDVDs = addDVD(titles, lengths, numDVDs, stdIn); } else if (op.equalsIgnoreCase("t")) searchByTitle(titles, lengths, numDVDs, stdIn);    else if (op.equalsIgnoreCase("l")) searchByLength(titles, lengths, numDVDs, stdIn); System.out.println('\n');...

  • This program is giving me an error in the main method at "outputFile.flush();" and "outputFile.close();" saying...

    This program is giving me an error in the main method at "outputFile.flush();" and "outputFile.close();" saying that it is unreachable code. Why is that, and how can I fix this?? import java.util.Scanner; import java.io.*; public class Topic7Hw {    static Scanner sc = new Scanner (System.in);       public static void main(String[] args) throws IOException {               PrintWriter outputFile = new PrintWriter ("output.txt");               outputFile.println("hello");               final int MAX_NUM = 10;...

  • Using java socket programming rewrite the following program to handle multiple clients simultaneously (multi threaded programming)...

    Using java socket programming rewrite the following program to handle multiple clients simultaneously (multi threaded programming) import java.io.*; import java.net.*; public class WelcomeClient { public static void main(String[] args) throws IOException {    if (args.length != 2) { System.err.println( "Usage: java EchoClient <host name> <port number>"); System.exit(1); } String hostName = args[0]; int portNumber = Integer.parseInt(args[1]); try ( Socket kkSocket = new Socket(hostName, portNumber); PrintWriter out = new PrintWriter(kkSocket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader(kkSocket.getInputStream())); ) { BufferedReader...

  • Can you help me rearrange my code to make it look cleaner but still give the...

    Can you help me rearrange my code to make it look cleaner but still give the same output? Also kindly add an in-line comment on what changes and rearrangement you've done so I can understand what's going on. import java.util.ArrayList; import java.util.Scanner; public class Bank { /** * Add and read bank information to the user. * @param arg A string, double and int array containing * the command line arguments. * @exception Any exception * @return an arraylsit of...

  • I need help with adding comments to my code and I need a uml diagram for...

    I need help with adding comments to my code and I need a uml diagram for it. PLs help.... Zipcodeproject.java package zipcodesproject; import java.util.Scanner; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Zipcodesproject { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input=new Scanner(System.in); BufferedReader reader; int code; String state,town; ziplist listOFCodes=new ziplist(); try { reader = new BufferedReader(new FileReader("C:UsersJayDesktopzipcodes.txt")); String line = reader.readLine(); while (line != null) { code=Integer.parseInt(line); line =...

  • If I enter a negative value the program throws an error and the withdrawal amount is...

    If I enter a negative value the program throws an error and the withdrawal amount is added to the balance please help me find why? public abstract class BankAccount { private double balance; private int numOfDeposits; private int numOfwithdrawals; private double apr; private double serviceCharge; //Create getter and setter methods public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public int getNumOfDeposits() { return numOfDeposits; } public void setNumOfDeposits(int numOfDeposits) { this.numOfDeposits =...

  • Running a program in Java about slidsender and slidreceiver with a brief explanation what each one...

    Running a program in Java about slidsender and slidreceiver with a brief explanation what each one is doing. slidreceiver import java.net.*; import java.io.*; class slidreceiver { public static void main(String a[])throws Exception { Socket s=new Socket(InetAddress.getLocalHost(),10); DataInputStream in=new DataInputStream(s.getInputStream()); PrintStream p=new PrintStream(s.getOutputStream()); int i=0,rptr=-1,nf,rws=8; String rbuf[]=new String[8]; String ch; System.out.println(); do { nf=Integer.parseInt(in.readLine()); if(nf<=rws-1) { for(i=1;i<=nf;i++) { rptr=++rptr%8; rbuf[rptr]=in.readLine(); System.out.println("The received Frame " +rptr+" is : "+rbuf[rptr]); } rws-=nf; System.out.println("\nAcknowledgment sent\n"); p.println(rptr+1); rws+=nf; } else break; ch=in.readLine(); } while(ch.equals("yes")); }...

  • Java: Hello, can someone please find a way to call my arraylist "list" and linkedhashmap called...

    Java: Hello, can someone please find a way to call my arraylist "list" and linkedhashmap called "jobMap" in my main method instead of calling them in the 2 classes? Also, is there a way to avoid the "Suppress Warning" portion in RoundRobin.java? I haven't been able to find a way for some reason. This is a job scheduling program, so the output should give the same values. To run: javac Main.java, java Main 5jobs.txt . txt file will be provided...

  • can some one help me solve this and explain it please Input Format A line indicating...

    can some one help me solve this and explain it please Input Format A line indicating the size of the array the array on the next line Constraints n < 10000 Output Format One line printing the array in order input (given to you) One line printing the array, followed by its maximum value Sample Input 0 5 1 3 5 7 9 Sample Output 0 1 3 5 7 9 9 7 5 3 1 9 Contest ends in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT