473,473 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

desperate need of help fixing code?!?!

17 New Member
i have tried everything but i keep getting these errors: illegal start of expression public Dvd()...and there's an arrow pointing under the p. the other error is: javalang.nosuchmethoderror.main exception in main thread.

i am providing my code so its not like im asking anyone to do it all for me...only to correct my mistakes cuz apparently i dont know what im doing or im not doing something right.

by the way im using jcreator for this program.

package dvdinventory;

public class Dvd {

public static void main(String[] args) {

String productNumber;
String itemName;
int numberofUnits;
double priceperUnit;

public Dvd()
{
productNumber = "0";
itemName = "";
numberofUnits = 0;
priceperUnit = 0.0;
}

public Dvd(String productNum, String productName, int quantity, double unitPrice)
{
productNumber = productNum;
itemName = productName;
numberofUnits = quantity;
priceperUnit = unitPrice;
}

public String getProductNumber()
{
return productNumber;
}

public String getProductName()
{
return itemName;
}

public int getNumberofUnits()
{
return numberofUnits;
}

public double getPricePerUnit()
{
return priceperUnit;
}
}
Nov 28 '07 #1
8 1072
JosAH
11,448 Recognized Expert MVP
You can't define a method within another method; first close your main() { ... }
method and only then define another one.

kind regards,

Jos
Nov 28 '07 #2
Kiamari
17 New Member
You can't define a method within another method; first close your main() { ... }
method and only then define another one.

kind regards,

Jos
i think it is closed....if not, where do i close it?
Nov 28 '07 #3
Laharl
849 Recognized Expert Contributor
Remove main() and its associated curly braces (one right after, one at the end) and make those Strings/doubles private. They are the instance variables (aka private data) for your class, the information that all DVDs have.
Nov 29 '07 #4
Kiamari
17 New Member
Remove main() and its associated curly braces (one right after, one at the end) and make those Strings/doubles private. They are the instance variables (aka private data) for your class, the information that all DVDs have.
i did some editing...so here is what i have so far:

package dvdinventory;

public class Dvd {

private String productNumber;
private String itemName;
private int numberofUnits;
private double priceperUnit;

public Dvd(String "0", String "", int 0, double 0.0)
{
productNumber = "0";
itemName = "";
numberofUnits = 0;
priceperUnit = 0.0;
}

public Dvd(String productNum, String productName, int quantity, double unitPrice)
{
productNumber = productNum;
itemName = productName;
numberofUnits = quantity;
priceperUnit = unitPrice;
}

public String getProductNumber()
{
return productNumber;
}

public String getProductName()
{
return itemName;
}

public int getNumberofUnits()
{
return numberofUnits;
}

public double getPricePerUnit()
{
return priceperUnit;
}
}


NOW there are 3 errors:
<identifier> expected
public Dvd(String "0", String "", int 0, double 0.0)
<identifier> expected
public Dvd(String "0", String "", int 0, double 0.0)
<identifier> expected
public Dvd(String "0", String "", int 0, double 0.0

arrow pointing after String before 0 in the first error, arrow pointing after String before "" in second error, and an arrow pointing after double before 0.0 in last error ?????

help?!?!
Nov 29 '07 #5
r035198x
13,262 MVP
sorry, havent a clue what youre talking about either??
For starters every opening brace must have a corresponding closing brace. Your opening brace for your main method does not have a corresponding closing brace.
Or maybe, do you know what the main method is?
Nov 29 '07 #6
JosAH
11,448 Recognized Expert MVP
@OP: (Kiamari): how come you've got your parentheses right in this thread but you're
complaining about this matter overhere? Don't double post; it confuses your readers
here and they will less likely respond to your chaotic questions.

kind regards,

Jos
Nov 29 '07 #7
Kiamari
17 New Member
@OP: (Kiamari): how come you've got your parentheses right in this thread but you're
complaining about this matter overhere? Don't double post; it confuses your readers
here and they will less likely respond to your chaotic questions.

kind regards,

Jos
it's not a double post...that's a seperate file i was having trouble with also
Nov 29 '07 #8
JosAH
11,448 Recognized Expert MVP
it's not a double post...that's a seperate file i was having trouble with also
No, you just are having compilation problems; please stick to one thread.

kind regards,

Jos
Nov 29 '07 #9

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

Similar topics

3
by: James | last post by:
Please help - getting very desperate! Sun, 12 October 2003 05:39 I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as...
5
by: Tank | last post by:
I have had this post up here when i was trying to figure out how to make leading zeros and have been able to fudge that to work. I am now have trouble getting the loop that makes the folders to...
24
by: Ministry Of Jute | last post by:
I returned home from work today to find an Airborne Express Letter Express mailer leaning up against my apartment door. The return addressee was Microsoft Suite 300 1165 Eastlake Avenue E...
5
by: John Flynn | last post by:
hi all i'm going to be quick i have an assignment due which i have no idea how to do. i work full time so i dont have the time to learn it and its due date has crept up on me .. As follows:...
1
by: JM | last post by:
Hi all, Further to my mail yesterday, haven't received much help and am getting slightly worried ! I am trying to add a block of cells but sadly can't get excel VBA to exactly read my...
1
by: Sajid | last post by:
Hello! Experts, I have the following piece of code in VB.NET that I want to use to update any records in the database. I would like to use a code as well as DataGrid to update the records....
4
by: melanieab | last post by:
Hi, Sorry this is a long message, but I'm getting desperate (and worried). I have a textbox (say, tb1) where the string is longer than the width of the box. If I'm coming from the previous...
7
by: Ladysniper | last post by:
DESPERATE doesn't begin to describe it. Can someone PLEASE tell me what is WRONG with this code? Now..a bit of background. It is a search results page for http://www.azsoma.info/directory.htm....
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.