Results 1 to 4 of 4
  1. #1
    Raven9 is offline Member
    Join Date
    Apr 2011
    Posts
    8
    Rep Power
    0

    Default Do not understand how to fix error I keeping getting in my code. Totally Confused.

    Java Code:
    import java.text.NumberFormat;
    import java.util.Locale;
    import java.util.Scanner;
    
       class Television {
    
        private String itemNumber;
        private String productName;
        private double unitPrice;
        private double unitPrice;
    
    
    
        //constructor
        public Television (String itemNumber, String productName, double units, double unitPrice) {
    
            setItemNumber(itemNumber);
            setProductName(productName);
            setUnitPrice(unitPrice);
         }
    
    
        //accessor methods for class variables
        public String getItemNumber () {
            return itemNumber;
        }
    
        public void setItemNumber (String itemNumber) {
            this.itemNumber = itemNumber;
        }
    
        public String getProductName () {
            return productName;
        }
    
        public void setProductName (String productName) {
            this.productName = productName;
        }
    
        public double getUnitPrice () {
            return unitPrice;
        }
    
        public void setUnitPrice (double unitPrice) {
            this.unitPrice = unitPrice;
        }
        public double getcalculateInventoryTotal() {
    		return totalAmt;
    
       }
    
    }
    
    
       public class InventoryPart1 {
    
        public static void main (String[] args) {
    
            NumberFormat nf = NumberFormat. getCurrencyInstance(Locale.US);
    
            //create an instance of the Television class
    
            Television samsung = new Television ("SAMSUNG 46", "Class 6400 Series",9.3,1,599.99);
    
            //use the methods from class Television to output the inventory details.
    
            System.out.println("Item Number: " + samsung.getItemNumber());
    
            System.out.println("Product Name: " + samsung.getProductName());
    
            System.out.print("Unit Price: " + nf.format(samsung.getUnitPrice()));
    
    		System.out.print("Inventory______ Total:_______"+
    
    			nf.format(Samsung.CalculateInventoryTotal())); {
    
    
         }
     }
    Last edited by Raven9; 04-18-2011 at 11:15 PM. Reason: This is the error C:\Documents and Settings\AdminUser\My Documents\InventoryPart1.java:83: reached end of file while parsing

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    We don't like code dumps here, please supply the error(Copy/paste) don't paraphrase. Ask specific questions.

    As a side note, you don't need to use setters in the constructor and it's fine to manipulate the instance variables directly.

  3. #3
    Raven9 is offline Member
    Join Date
    Apr 2011
    Posts
    8
    Rep Power
    0

    Default

    I apologize if I did not post this correctly desperately looking for some help. I am new to all of this so do not understand the majority of this. the error message I keep getting is as follows:

    C:\Documents and Settings\AdminUser\My Documents\InventoryPart1.java:83: reached end of file while parsing
    }
    ^
    1 error

    Tool completed with exit code 1

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Whenever you see that error look at your curly braces. Make sure you have a closing brace for every open brace. Hint: Your problem is in the main method.

Similar Threads

  1. Understand Code
    By Quizzle23 in forum New To Java
    Replies: 9
    Last Post: 03-07-2011, 10:07 PM
  2. need to understand code
    By Masken2 in forum New To Java
    Replies: 2
    Last Post: 02-17-2011, 04:21 PM
  3. please help me,,,, i m totally confused
    By uday shankar singh in forum AWT / Swing
    Replies: 3
    Last Post: 04-10-2010, 03:26 AM
  4. understand the code
    By prof.deedee in forum New To Java
    Replies: 8
    Last Post: 11-11-2009, 02:43 AM
  5. Trying to understand this code
    By new2java2009 in forum New To Java
    Replies: 2
    Last Post: 09-09-2009, 07:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •