Im sorry earlier i didnt know the rules but i know them now. Ive been trying all day and this is the farthest i could get...

/**
 * Program designed to keep the inventory of books in a bookstore.
 * 
 * @author 
 * @version 1.0 Dveloped on May 3, 2009
 */

import java.awt.*;
import javaswing.*;
import java.awt.*;


public class Books
{
    Variables
    String Title;
    private int Price, Pages; 
    
    
    METHODS
    
    private int getTitle(), setTitle(), setPrice(), getPrice(), setPages(), getPages();
    {
        
        private void Booklet implements displayProperties()
        {
            
            
        }
        
        
        
        
        private viod createGUI
        {
            
        }

This is the original problem below please someone help.Thanks.


Write a project to keep the inventory of books in a book store. Create a book class with the following variables and methods

Title
Price
Pages

getTitle()
setTitle()
setPrice()
getPrice()
setPages()
getPages()

create a subclass ok book called booklet with the following additional method

display properties()

The displayProperties method will print the title, price, and number of pages. Create a GUI to create booklets and display each booklets properties.

Recommended Answers

All 3 Replies

Note the revisions. There is still a lot for you to do, but this will at least compile.

import java.awt.*;
import javax.swing.*;


public class Book
{
//  Variables
    String Title;
    private int Price, Pages; 
    
    
//    METHODS

    private String getTitle()
    {
        return Title;
    }


    private void setTitle (String title)
    {
        Title = title;
    }

    private int getPrice ()
    {
        return Price;
    }

    private void setPrice (int price)
    {
        Price = price;
    }
                
    private void createGUI ()
    {
            
    }
}


class Booklet extends Book
{
    // Methods

    public void displayProperties ()
    {
    }
}

Note the typo corrections. Note that Booklet EXTENDS Book and is NOT located within the Book class (that's my interpretation of the assignment at least). See the following link on subclasses.

http://www.java-tips.org/java-se-tips/java.lang/what-is-a-java-subclass.html

Typos count. The swing library is javax.swing (see line 2 above). It is void , not viod .

Note that I added the comment sign // before "Methods" and "Variables". These lines are to remind YOU and are to be ignored by the compiler. Thus you must make them comments. They are not commands. getTitle , setTitle , etc., are methods. Don't separate them with commas as you can do with variables. They each have their own brackets. Title is a String, so getTitle returns a String, not an int, and setTitle takes a String as a parameter.

Hope this helps get you started.

Ah just seen that I'm minute too late. VernonDozier provided some bits that I left for you to finish

You are expected to create at least 3 classes let call them Book, Booklet and BookletsGUI.

Your provided code is real mess and show that you are seriously behind your class studies.

The book class should look something like this

public class Book{

    private String title;

    public Book(){}

    public void setTitle(String str){ title = str;}
    public String getTitle(){ return title;}
}

Declaration of other variables plus getter and setter methods to these variables is same as title.

For the Booklet you need to know something about subclasses, so reading of Inheritance tutorial is expected of you! After that you should be able to fill in rest of the code

public class Booklet extends Book{

    //YOUR CODE HERE

}

And there is GUI, where you have to be able collect and validate data provided by user, plus store them somewhere (database would be nice, by you can do it with file too) also retrieve and display what ever was stored previously. So Creating a GUI with JFC/Swing is something to look into

Now this ill-mannered thing you did..

Thanks a lot for your help. I need to get this done by 11 am tommorow because its my final for the class. Everything you said to me doesent really make sense because im so behind do you think you can finish it for me? I can paypal you some money for it if you want but i just need to pass this class id really appreciate it. Thanks!

If I received only one I may leave it be, but to get 3 is too much. Shame on you and you deserve to fail.

commented: Well said! +30
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.