Author | Message |
---|---|
The Real Bryan
Posts: 12
|
Posted 16:20 Jan 31, 2020 |
I've been trying to do this homework for hours now, but I'm still not getting what I am even doing! The format of the homework file is very messy and unorganized (I'm starting to get CS 1222 vibes from looking at the file), has no examples of how the code should progressively look, and the Intro Java book is not helping out (I read the entirety of Chapter 9 for help, but it's not working out). What am I supposed to do with three classes? Combine them all? Connect each of the three? Make driver classes for each one? There is no indication of what I should even do! Last edited by The Real Bryan at
16:22 Jan 31, 2020.
|
mgonzalez12000
Posts: 4
|
Posted 17:27 Jan 31, 2020 |
The homework is asking for you to create a book class AND an order class that exists within the book class. Imagine the book class as a "blueprint" for your program. In the other hand, you will also need to create a new class for your java project. Doing so, you will create a bookstore class which will serve as the main class/driver. This class is essentially what will make your program run. I'm currently working on the same assignment but am having trouble on the calcCost method. Last edited by mgonzalez12000 at
17:28 Jan 31, 2020.
|
Safa Al Mahbub
Posts: 13
|
Posted 17:44 Jan 31, 2020 |
You are meant to create 2 classes (a Book class and an Order class) and one main/driver class (the BookStore class). For the Book and Order class, the data fields you are supposed to create are listed. You must include the concept of encapsulation with each of them (I.e making the data felids/methods public or private and creating getters and setters for each private data field. The BookStore class will act as your main class. You must also create this class to test/use the other classes you created, as we did (TriangleDriver, PencilDriver, CircleDriver. etc). In class we created a driver class for each of the classes we made (Triangle, Pencil, Circle) but it is not necessary in this assignment to make a driver for each. You will use each object in the BookStore class which will act as your main class. I have created a simplified demo for the assignment, which is now available in the Coding Example section on the class page. In this example there is a Pokemon class, a Pokedex class, and a PokemonShow class. These will respectively be analogous to Book, Order, and BookShop. The Pokemon class describes what a pokemon is through it's data fields and has proper encapsulation with getters and setters. It also has a modified toString() method. The Pokedex class is essentially a way to collect pokémon's and so only has an id for the pokedex and an ArrayList for the Pokemon you have collected. We will go over ArrayList in detail in next Tuesday's class. For now you may use an Array initialized with 10 spaces. The PokemonShow class is going to be our main class. As you can see I do not have a PokemonDriver or PokedexDriver. I will be using the PokemonShow class to test and use the other classes. In this class I have a loop asking the user if they want to add a pokemon to the Pokedex or exit. As you can see in my example I only add a Pikachu. In your HW assignment you will have to add the code here to create a Book which would then be added to the Order. I am creating a demo for this assignment because transitioning from procedural programming to OOP is very difficult, but you should NOT expect a demo for every assignment. |
Safa Al Mahbub
Posts: 13
|
Posted 18:18 Jan 31, 2020 |
Just a little clarification that Book and Order should be two separate class files. |