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.

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.

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

Class Book:

- stockNumber : Integer
- author : String
- title : String
- price : Float
- numberOfPages : Integer

+ setBookData(stockNumber: Integer, author: String, title: String, price: Float, numberOfPages: Integer) : void
+ printBookData() : void

---

+ Book(stockNumber: Integer, author: String, title: String, price: Float, numberOfPages: Integer)

---

Class TextBook extends Book:
- gradeLevel : String

+ setTextBookData(stockNumber: Integer, author: String, title: String, price: Float, numberOfPages: Integer, gradeLevel: String) : void
+ printTextBookData() : void

---

+ TextBook(stockNumber: Integer, author: String, title: String, price: Float, numberOfPages: Integer, gradeLevel: String)

---

Pseudocode for class Book:
Class Book:
Initialize stockNumber, author, title, price, numberOfPages

Method setBookData(stockNumber, author, title, price, numberOfPages):
Set the stockNumber
Set the author
Set the title
Set the price
Set the numberOfPages

Method printBookData():
Print the stockNumber
Print the author
Print the title
Print the price
Print the numberOfPages

---

Pseudocode for class TextBook:
Class TextBook extends Book:
Initialize gradeLevel

Method setTextBookData(stockNumber, author, title, price, numberOfPages, gradeLevel):
Call parent class setBookData method with stockNumber, author, title, price, and numberOfPages parameters
Set the gradeLevel

Method printTextBookData():
Call parent class printBookData method
Print the gradeLevel

Sure! Let's start with the Book class.

Class Diagram for Book Class:
```
---------------------
| Book |
---------------------
| - stockNumber |
| - author |
| - title |
| - price |
| - numberOfPages |
---------------------
| + setBookData() |
| + printBookData() |
---------------------
```

Pseudocode for Book Class:
```
class Book:
private attributes:
stockNumber
author
title
price
numberOfPages

public methods:
setBookData(stockNum, auth, titl, prc, pages):
Set stockNumber to stockNum
Set author to auth
Set title to titl
Set price to prc
Set numberOfPages to pages

printBookData():
Print "Stock Number:", stockNumber
Print "Author:", author
Print "Title:", title
Print "Price:", price
Print "Number of Pages:", numberOfPages
```

Now let's move on to the TextBook class, which is a child class of the Book class.

Class Diagram for TextBook Class:
```
------------------------------
| TextBook |
------------------------------
| - gradeLevel |
------------------------------
| + setBookData() |
| + printBookData() |
------------------------------
```

Pseudocode for TextBook Class:
```
class TextBook extends Book:
private attribute:
gradeLevel

public methods:
setBookData(stockNum, auth, titl, prc, pages, grade):
Call setBookData from the parent class, passing stockNum, auth, titl, prc, and pages
Set gradeLevel to grade

printBookData():
Call printBookData from the parent class
Print "Grade Level:", gradeLevel
```

In this way, the TextBook class inherits the attributes and methods from its parent class, Book, and also adds a new data field, gradeLevel. The setBookData() and printBookData() methods are overridden to accommodate the new gradeLevel field.