programming

Design a class named Book that holds a stock number, author, title, price, and number of pages for a book. Include a method that sets all the data files and another that prints the values for each data field. Create the class diagram and write the pseudocode that defines the class.

Design a class named TextBook that is a child class of Book. Include a new data field for the grade level of the book. Override the Book class methods that set and print the data so that you accommodate the new grade-level field. Create the class diagram and write the pseudocode that defines the class.

  1. 2
asked by hazy
  1. Very basic pseudo code is what we're dealing with. New to OOP and I do not understand it. I'm not asking anyone to simply solve these problems but rather help walking me through them if possible. These are not assignments, just exercises from the book that I'm trying to do on my own time.

    posted by hazy
  2. class Book
    // Declarations
    private num stockNumber
    private num price
    private num bookPageNum
    private string author
    private string title

    //Methods to set the values.
    public void setStockNumber(num stockNumber)
    this.stockNumber = stockNumber
    return

    public void setPrice(num price)
    this.price = price
    return

    public void setBookPageNum(num bookPageNum)
    this.bookPageNum = bookPageNum
    return

    public void setAuthor(string author)
    this.author = author
    return

    public void setTitle(string title)
    this.title = title
    return


    //Methods to get the values.
    public num getStockNumber()
    return stockNumber

    public num getPrice()
    return price

    public num getBookPageNum()
    return bookPageNum

    public string getAuthor()
    return author

    public string getTitle()
    return title

    endClass

    posted by Ralph Return

Respond to this Question

First Name

Your Response

Similar Questions

  1. Program Design and Development

    Help on Design a class named Book that holds a stock number, author, title, price, and number of pages for a book. Include methods to get and set the values for each data field. Write the pseudocode that defines the class?
  2. programming

    Design a class named Book that holds a stock number, author, title, price, and number of pages for a book. Include methods to set and get the values for each data field. Also include a displayInfo() method that displays each of
  3. Design

    Design a class named StockTransaction that holds a stock symbol (typically one to four characters), stock name, number of shares traded, and price per share. Include methods to set and get the values for each data field. Create
  4. Program Design and Development

    Help on Design a class named StockTransaction that holds a stock symbol (typically one to four characters), stock name, number of shares traded, and price per share. Include methods to set and get the values for each data field.
  5. Python: Named tuples

    I've been trying to print a list of the book titles within the named tuple in alphabetical order, but I don't know what I'm doing wrong. I've set up my named tuple as so: Book = namedtuple('Book', 'author title genre year price
  6. C#

    The Peterman Publishing Company has decided that no published book should cost more than 10 cents per page. Create a BookException class whose constructor requires three arguments: a string Book title, a double price and an int
  7. Python: Creating function

    The value of the inventory of a particular book is the price of that book times the number of copies we have in stock. Write a function called inventory_value that takes a Book as its argument and returns the value of our
  8. English

    Check all that apply. If you are using parenthetical citation for a book, what information needs to be put in parentheses? a) the author's name b) the author's last name c) the book's title d) the publisher e) the page number
  9. Microeconomics - determining how many to sel

    Hi, I would really appreciate it if someone could help me with these questions: An author earns royalties from his book that are specified as 10% of the book's selling price. The demand curve for this is straight and downward
  10. pseudocode

    Create a class named Year that contains data fields to hold the number of months in a year and the number of days in a year. Include a constructor that sets the number of months to 12 and the number of days to 365, and get and set

More Similar Questions