Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: java programming its so hard i need help please.

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java programming its so hard i need help please.

    Write Java statements as required in the following questions:
    1) Look at the following partial class definition, and respond the questions that follow it:

    public class Book
    {
    private String title;
    private String author;
    private String publisher;
    private int copiesSold;
    }


    a) Write a no-arg constructor for this class. It assigns all String fields to “N/A” and the copiesSold to 0.









    b) Write an overloaded constructor that accepts arguments to initialize title, author and publisher. It assigns copiesSold to 0.











    c) Write another overloaded constructor for this class. The constructor should accept an argument for each of the field.









    d) Write an accessor method for the title field.








    e) Write a mutator method for the copiesSold field.








    f) Draw a UML diagram for the class, including the methods you have written.



    ANYTHING WILL HELP PLEASE.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: java programming its so hard i need help please.

    Take the questions one at a time and try to answer them. Post your code and your questions or the error messages.

    Take a look at the tutorial: http://docs.oracle.com/javase/tutori...structors.html

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. java programming its so hard i need help please.
    By javaishard in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 16th, 2012, 11:54 PM
  2. android programming vs game programming using java
    By vgoel38 in forum Android Development
    Replies: 4
    Last Post: September 8th, 2012, 05:48 PM
  3. Re: How hard would this be to write for a Beginner?
    By ronaldreinne in forum Java Theory & Questions
    Replies: 2
    Last Post: August 14th, 2012, 11:33 PM
  4. Replies: 0
    Last Post: December 12th, 2011, 03:17 PM
  5. new to java.... having a hard time trying to read code
    By Newbie_96 in forum Java Theory & Questions
    Replies: 2
    Last Post: August 6th, 2011, 01:51 AM