Search:

Type: Posts; User: Norm

Search: Search took 0.08 seconds.

  1. Re: Default Write a Java program to simulate an online shopping cart.

    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....
  2. Re: Default Write a Java program to simulate an online shopping cart.

    Change case 2 so its new statement uses the same type of arguments as for the new statement in case 1.
  3. Re: Default Write a Java program to simulate an online shopping cart.

    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,...
  4. Re: Default Write a Java program to simulate an online shopping cart.

    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...
  5. Re: Default Write a Java program to simulate an online shopping cart.

    Please copy and post the code where you tried and the error messages you get.
  6. Re: Default Write a Java program to simulate an online shopping cart.

    Look at the code for the CartItem class and find its constructors. Then write the new statement to use one of them.
  7. Re: Default Write a Java program to simulate an online shopping cart.

    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...
  8. Re: Default Write a Java program to simulate an online shopping cart.

    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.
  9. Re: Default Write a Java program to simulate an online shopping cart.

    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. ...
  10. Re: Default Write a Java program to simulate an online shopping cart.

    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.
  11. Re: Default Write a Java program to simulate an online shopping cart.

    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...
  12. Re: Default Write a Java program to simulate an online shopping cart.

    Look at post#10
  13. Re: Default Write a Java program to simulate an online shopping cart.

    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
  14. Re: Default Write a Java program to simulate an online shopping cart.

    Read the API doc for the Scanner class and find a method that will read the type of data that you want to enter.
  15. Re: Default Write a Java program to simulate an online shopping cart.

    Yes its the same problem. nextInt() wants an integer. What was entered?
  16. Re: Default Write a Java program to simulate an online shopping cart.

    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.
  17. Re: Default Write a Java program to simulate an online shopping cart.

    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()...
  18. Re: Default Write a Java program to simulate an online shopping cart.

    Can you explain what problems you are having with the program? What items are working and what items are you currently working on?
Results 1 to 18 of 18