Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: JAVA1 - Final Project

  1. #1
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default JAVA1 - Final Project

    Hi All,

    I am working on my first final project for JAVA certification. I am trying to make a simple bank account. The bank account contains Transactions and my main method is going to be in the Bank Statement, which will tell the Bank Account to Process Transactions.

    I am stuck at my Transaction Level code. Its so easy I do not know how I am messing up. Any help is appreciated.

    Here is my code - (very basic, I know)
    public class Transaction
    {
    	String merchant;
    	double amount;
     
    	public Transaction  (String inMerchant, double inAmount)
    	{
    		merchant = inMerchant;
    		amount = inAmount;
    	}
     
    	public String getDescription()	
    	{
    		return merchant;
    	}
     
    	public double getTotal()
    	{	
    		return amount;
    	}
    }

    Here is the error message

    C:\Users\ch103\JAVA1>javac Transaction.java
    Transaction.java:17: ';' expected
    public double getTotal()
    ^
    Transaction.java:22: class, interface, or enum expected
    }→
    ^
    2 errors



    I have ensured that my number of opening brackets equals the number of closing brackets, aside from that I believe I should compile without error...

    Thank You everyone for your time and help!

    ch103
    Last edited by JavaPF; October 11th, 2011 at 03:22 AM. Reason: Use highlight tags around code!!


  2. #2
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: JAVA1 - Final Project

    looks like your missing a ";" maybe after "public class Transaction"?

  3. #3
    Member
    Join Date
    Aug 2011
    Posts
    34
    My Mood
    Inspired
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: JAVA1 - Final Project

    Since I am only "almost" done the 1st of a 3 part Java certification program I could be wrong but I thought that you only needed ";" after statements and not while declaring methods...

  4. #4
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: JAVA1 - Final Project

    your right my bad I was looking at the placement not the actual method... It would be a lot easier to read if you put it in the format of [1code]Program inside here[/1code](remove the "1" from each []) that should keep the tabs and spacing intact from copying and pasting it over from your IDE.

  5. #5
    Junior Member
    Join Date
    Sep 2011
    Posts
    24
    My Mood
    Mellow
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JAVA1 - Final Project

    What IDE/JDK are you using. I compiled the code provided using the most recent version of JDK 6 and JCreator LE and it produced no errors.

Similar Threads

  1. Final year java project
    By aj4u in forum The Cafe
    Replies: 3
    Last Post: October 13th, 2011, 12:47 AM
  2. can we create this as my final year project ?
    By naved in forum Java Theory & Questions
    Replies: 1
    Last Post: July 16th, 2011, 02:33 AM
  3. final project idea
    By zulqar in forum AWT / Java Swing
    Replies: 4
    Last Post: November 3rd, 2010, 07:28 AM
  4. final project idea
    By zulqar in forum Java Theory & Questions
    Replies: 1
    Last Post: November 1st, 2010, 12:02 PM
  5. need idea for final year project
    By asadkhan in forum Java Applets
    Replies: 0
    Last Post: August 22nd, 2010, 01:36 AM