I am not understanding how to fix these problems. I have placed bracket, removed brackets. Could someone please help break this down. most of my error is cannot find symbols, line 80 is unclosed character, 113, 121, 126, 127, 137,is class, interface or enum expected. I am suppose to modify the program so that it handles multiple items.

  1. create a method to calculate the value of the entire inventory.
  2. create another method to sort the array items by the name of the product.

here is my code so far:

//InventoryPart2
import java.util.Scanner;
//Inventory program
//Program monitors DVD inventory, prices, and stock

public class InventoryPart2 {

 public static void main(String[] args){
//create Scanner to obtain input from command window
     Scanner input = new Scanner(System.in);

        {//begin main method
            System.out.print("Welcome to the My DVD inventory program");//welcome
            System.out.println();//blank line

            //declare variables

            String DVDTitle;
            double ItemNum = 0.00;
            int items = 0;
            double DvdPrice = 0.00;
            int count;//counter control variable
            double DvdRestock = 0.00;

   System.out.println("How many DVDs would you like to order?");//prompt for lenght of array
        count = input.nextInt();//prompt for users input
        String removeNewLine = input.nextLine();//removes newline created by pressing <enter>
   {
          //declare arrays
         DVD[] my = new DVD[count];
      }
              for (int i = 0; i<count;i++)
              {//input count for new DVD's
          {
         System.out.println();//blank line
         System.out.println("Enter title of DVD.");//prompt for title
         }
         DVDTitle = input.nextLine();//user input
         System.out.println();//blank line
         }
              {
         System.out.println("Please enter item Number.");//prompt for item number
         unitNumber = input.nextDouble();//user input item number as double

         System.out.println();//blank line

         System.out.println("Please enter price of DVD.");//prompt for price
         DVdPrice = input.nextDouble();//enter price

         DVD newDVD = new DVD(DVDTitle, itemNumber, itemPrice, itemsStocked);
         //place dvd's created in the array of dvd's

         myDVD[count] = newDVD;

         }//end for

        double DvdValue = (DvdPrice*itemStock);

        //double totalInventory = Value();

        for(int i = 0;i<count;i++)
        {//print information from array

            System.out.println("DVD Title:"+ DVDTitle);
            System.out.println("Item Number:" + ItemNumber);
            System.out.println("Price:" + DVDPrice);
            System.out.println("Number in Stock" +NumberInStock);
            System.out.println("Stock Value:" + DvdValue);
            System.out.println();//blank line

            }//end for
        System.out.println("Total Inventory:" + totalInventory);

        }//end main method

     public class DVD
     {

         //declare variables
         String DvdTitle = '--';   <---(unclosed character)
         double itemNumber = 0.00;
         double ItemPrice = 0.00;
         int NumberInStock = 0;
         double restockFee = 0.00;

         //constructor
         public DVD (String DvdTitle, double ItemNumber, double ItemPrice, int NumberInStock, double RestockFee){

         }

        public DVD(){

         this.DvdTitle = DvdTitle;
         this.itemNumber = itemNumber;
         this.DVDPrice = DVDPrice;
         this.NumberInStock = NumberInStock;
         this. restockFee = RestockFee;
          }

        //get and set methods
        public String getDvdTitle()
         {
            return DvdTitle;
        }

        public void setDVDTitle(String DvdTitle)
         {
            this.DvdTitle = DvdTitle;
            }
         {
        public double getItemNumber()<--line 111(missing method body or declare abstract)
            }
            return ItemNumber;  <--- (cannot find symbol)
       }
     public void setItemNumber(double ItemNumber) <---(class, interface or enum expected)
             {

         this.ItemNumber = itemNumber;


     public double getDvdPrice()
             {
         return DvdPrice;


     public void setDvdPrice(doublePrice)
             {
         this.DvdPrice = DvdPrice;


     public int getNumberInStock(int NumberInStock){
         }
    {
     return numberInStock;


         public double getRestockFee()
                 }
     {
 }
     return(NumberInStock * DvdPrice);

     //end classDVD

Thank You,
deniseblue

Recommended Answers

All 2 Replies

First off on line 80 you need double quotes instead of single ones, when you use single quotes the JVM assumes that you are manually entering a char instead of a string.

113 is messing up because on 110 you have an open bracket and 112 is a close instead of an open.

You also need close brackets on 119, 124 and 129.

There are numerous other problems as well, but those should be easy to work through once you get your braces right.

First off on line 80 you need double quotes instead of single ones, when you use single quotes the JVM assumes that you are manually entering a char instead of a string.

113 is messing up because on 110 you have an open bracket and 112 is a close instead of an open.

You also need close brackets on 119, 124 and 129.

There are numerous other problems as well, but those should be easy to work through once you get your braces right.

Thank you for the reply, I am still trying to fix my code, so far I have made it worser. I will repost after I try and fix what you have said to do, plus work on the other problems

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.