There is a variable with a null value on line 16. Look at line 16 in the your source and see what variable is null. Then backtrack in the code to see why that variable does not have a valid value....
Type: Posts; User: Norm
There is a variable with a null value on line 16. Look at line 16 in the your source and see what variable is null. Then backtrack in the code to see why that variable does not have a valid value....
Change case 2 so its new statement uses the same type of arguments as for the new statement in case 1.
No. Those lines of code where an example, not part of your code.
Copy all the constructor definition statements
and the new statement you are trying to use
and paste them here in the thread,...
Copy the constructor definition
and the new statement you are trying to use and paste them one above the other. That will allow you to compare the required arguments with the ones you are using and...
Please copy and post the code where you tried and the error messages you get.
Look at the code for the CartItem class and find its constructors. Then write the new statement to use one of them.
The compiler can not find a constructor for the CartItem class that takes a String for an argument.
Either add a constructor to the class that takes a String as argument
or change the new statement...
Please copy the full text of the compiler's error messages and paste it here. I don't see any error messages in the image.
Sorry, I don't write code for students.
What Scanner class method are you trying to use to read a String? When you look at the list of methods, what the method returns is in the left column. ...
Pick one of the fields in the class and write a getter and a setter method for it. Try to compile it. Copy and paste it here with any error messages you got.
Those are very standard methods for a lot of classes. Did your instructor discuss what they were and how they worked? Have you done a search on the internet for them?
Try this: java getters and...
Here is the link to the API doc for all the Java SE classes. Find the class in the lower left, click the link and the API doc for the class will be shown in the main window.
Java Platform SE 7
Read the API doc for the Scanner class and find a method that will read the type of data that you want to enter.
Yes its the same problem. nextInt() wants an integer. What was entered?
At line 58 the code is trying to read an integer using the nextInt() method. "jeans" is not an integer.
Either change the code to read a String or have the user enter an integer value.
Please copy the full text of the error message and paste it here. It has important info about the error.
The getter/settor methods are very simple and shouldn't be a problem.
The toString()...
Can you explain what problems you are having with the program? What items are working and what items are you currently working on?