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 - Library & Books Program ( ANY HELP IS USEFUL )

  1. #1
    Junior Member
    Join Date
    Mar 2019
    Location
    England
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Java - Library & Books Program ( ANY HELP IS USEFUL )

    Hi there, I am trying to follow a spec to create a library which displays a title, a list of array items (authors) and the price.
    The code below is what I have so far... The file Tree looks like this.

    library
    JRE System Library
    src
    library.client
    Main.java
    library.model
    Books.java


    Any help would be appreciated.

    ---------------------------------------------------
    package library.client;
     
    public class Main 
    {
    	public static void main(String[] args)
    	{
     
    	}
    }
    ---------------------------------------------------
    package library.model;
     
    public class Book 
    {
    	// Declaring Variables
    	private String title;
    	private String[] authors;
    	private double price;
     
     
    	// Constructor
    	public Book(String title, String[] authors, double price)
    	{
    		this.title = "Book Title";
    		this.authors = new String[] {"Theresa.M", "Jeremy.C", "Boris", "BigLiz", "Phillip"};
    		this.price = 15.55;
    	}
     
     
    	// Getter & Setter Methods
    	public String getTitle()
    	{
    		return title;
    	}
    	public void setTitle(String title)
    	{
    		this.title = title;
    	}
    	public double getPrice()
    	{
    		return price;
    	}
    	public void setPrice(double price)
    	{
    		this.price = price;
    	}	
    }
    Last edited by daily-moto-rider; March 11th, 2019 at 11:37 AM.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,309
    Thanks
    53
    Thanked 2,391 Times in 2,345 Posts

    Default Re: Java - Library & Books Program ( ANY HELP IS USEFUL )

    Any help would be appreciated.
    Please explain what problems you are having and ask some specific java programming questions.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Java adding borrow and return books in library
    By Pentrax in forum Object Oriented Programming
    Replies: 11
    Last Post: December 20th, 2017, 04:21 PM
  2. Java 2 & Java 6 Books - What's the difference?
    By Hawwi in forum Java Theory & Questions
    Replies: 6
    Last Post: December 15th, 2013, 01:45 PM
  3. Beginner Java Books & College
    By Hawwi in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 12th, 2013, 08:45 AM
  4. Replies: 0
    Last Post: March 11th, 2012, 08:36 AM

Tags for this Thread