473,383 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Homework Help for Java

1
Help me please. I am having problems with my homework assignment. We are to create a product class that hold the item number, the name of the product, the number of units in stock, and the price of each unit. Here is my problem. I have written the program ( I use netbean) and I have encountered plenty of errors. The error messages that I get are as follows:
  1. illegal start type
  2. cannot find symbol
  3. operator cannot be applied
  4. assignment to itself

Here is what I have done so far. It would be great if there would be someone that would be able to help me throughout the next few weeks of assignments. Thanks
DonE


public class DVDInventory
{
//Inventory for DVD


import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

class product comparable
{
String name; //class variable that stores item name
double number; //class variable that stores item number
long stockQuantity; //class variable that stores the quantity in stock
double price; //class variable that stores the items price
public product();
{
name = "";
number = 0.0;
stockQuantity = OL;
price = 0.0;
}
public product(String name,int number,long stockQuantity,double price);
{
this.name = name
this.number = number;
this.stockQuantity = stockQuantity;
this.price = price;

}
public void setItemName(String name)
{
this.name = name;
}
public String getItemName()
{
return name;
}
public void setItemNumber(double number)
{
this.number = number;
}
public double getItemNumber()
{
return number;
}
public void setstockQuantity(long quantity)
{
stockQuantity = quantity;
}
public long getstockQuantity()
{
stockQuantity = quantity;
}
public long get stockQuantity()
{
return stockQuantity;
}
public void setItemPrice(double price)
{
this.price = price;
}
public double getItemPrice()
{
return price;
}
public double calculateInventoryValue()
{
return getItemPrice()*getStockQuantity();
}

public StringtoString()
{
return "\nName:"+getItemName()+"\nNumber:"+number"\nprice :$"+price+
"\nQuantity:"+stockQuantity+"\nValue:$"+calculatIn ventoryValue();
}//end product
class DVD(String name, int number, long stockQuantity, double price,
String titles)

private String titles;
public DVD()
{
super();//call constructor in product
titles = "";//add the additional attribute
}

Public DVD(String name, int number, long stockQuantity, double price,
String titles)
{
super(name, number, stockQuality, price); //call constructor in product
this.titles = titles; //add the additional attribute
}
public void settitle(String title)
{
this.titles = titles;
}
public string gettitles()
{
return titles;
}
public double calculateInventoryValue()
{
return getItenPrice()* getstockQuantity();
}
return "\nName:"+getItemName()+"\nNumber:"+getItemNumber( )+"\nPrice:$"
+getItemPrice()+"\nQuantity:"+getstockQuantity()+" \ntitles:"
gettitles()+"\nValue:$"+CalculateInventoryValue();
}}

}//end DVD
Mar 8 '08 #1
2 1411
JosAH
11,448 Expert 8TB
  1. illegal start type
  2. cannot find symbol
  3. operator cannot be applied
  4. assignment to itself
The compiler tells you a lot more than just that, e.g. it shows the line number
where the compilation error was noticed, it displays the offending symbol(s)
and more when it can. Please don't let us guess about that information.

kind regards,

Jos
Mar 8 '08 #2
sukatoa
539 512MB
Help me please. I am having problems with my homework assignment. We are to create a product class that hold the item number, the name of the product, the number of units in stock, and the price of each unit. Here is my problem. I have written the program ( I use netbean) and I have encountered plenty of errors. The error messages that I get are as follows:
  1. illegal start type
  2. cannot find symbol
  3. operator cannot be applied
  4. assignment to itself

Here is what I have done so far. It would be great if there would be someone that would be able to help me throughout the next few weeks of assignments. Thanks
DonE


public class DVDInventory
{
//Inventory for DVD


import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

class product comparable
{
String name; //class variable that stores item name
double number; //class variable that stores item number
long stockQuantity; //class variable that stores the quantity in stock
double price; //class variable that stores the items price
public product();
{
name = "";
number = 0.0;
stockQuantity = OL;
price = 0.0;
}
public product(String name,int number,long stockQuantity,double price);
{
this.name = name
this.number = number;
this.stockQuantity = stockQuantity;
this.price = price;

}
public void setItemName(String name)
{
this.name = name;
}
public String getItemName()
{
return name;
}
public void setItemNumber(double number)
{
this.number = number;
}
public double getItemNumber()
{
return number;
}
public void setstockQuantity(long quantity)
{
stockQuantity = quantity;
}
public long getstockQuantity()
{
stockQuantity = quantity;
}
public long get stockQuantity()
{
return stockQuantity;
}
public void setItemPrice(double price)
{
this.price = price;
}
public double getItemPrice()
{
return price;
}
public double calculateInventoryValue()
{
return getItemPrice()*getStockQuantity();
}

public StringtoString()
{
return "\nName:"+getItemName()+"\nNumber:"+number"\nprice :$"+price+
"\nQuantity:"+stockQuantity+"\nValue:$"+calculatIn ventoryValue();
}//end product
class DVD(String name, int number, long stockQuantity, double price,
String titles)

private String titles;
public DVD()
{
super();//call constructor in product
titles = "";//add the additional attribute
}

Public DVD(String name, int number, long stockQuantity, double price,
String titles)
{
super(name, number, stockQuality, price); //call constructor in product
this.titles = titles; //add the additional attribute
}
public void settitle(String title)
{
this.titles = titles;
}
public string gettitles()
{
return titles;
}
public double calculateInventoryValue()
{
return getItenPrice()* getstockQuantity();
}
return "\nName:"+getItemName()+"\nNumber:"+getItemNumber( )+"\nPrice:$"
+getItemPrice()+"\nQuantity:"+getstockQuantity()+" \ntitles:"
gettitles()+"\nValue:$"+CalculateInventoryValue();
}}

}//end DVD
Just a reminder that next time, use code tags when you are to post java codes... ;-)

Sukatoa.
Mar 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JWest46088 | last post by:
I am having trouble figuring out how to add, subtract, multiply, and divide fractions in my Java program. First off I will tell you what I already did. At first, the assignment was to: Define a...
16
by: matchuglenn | last post by:
1: A Geographic Distance Calculator Write an application to calculate a table of geographic distances. The input of your application is a file containing the coordinates of cities in latitude /...
2
by: mia23 | last post by:
Hello, I am a java beginner and I need series help in solving this program; my assignment is due after 2 days and I can't understand this program . This is THE PROGRAM:  The ABC medical clinic...
4
by: java4life | last post by:
I have two java scripts below. I am expected to write a TestProgram to generate the out put below. Please help with the TestProgram. Lecturer 65374 has 2 students: Student number 1 has name of...
1
by: tikney5 | last post by:
I need to modify my current program so that is uses a class to store and retrieve the employees name, hourly rate, and number of hourse worked. Use a constructor to initialize the employee...
8
by: garyrowell | last post by:
I have been at this programme for hours trying to work out what is wrong. Any help would be very much appricated. Here is the breif I received. The program This week you are going to write three...
3
by: araunity2006 | last post by:
I have this question for a lab in Univeraity to make AVLtrees here is the question. c) Implement the AVL tree ADT. You must implement the tree class, including insert() and print() methods, as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.