X Tutup
Skip to content

Commit fc14733

Browse files
committed
checkpoint
1 parent ba7afb8 commit fc14733

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

reader/ReadingJava/Programs/Bookstore.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
// Make Bookstore class a "collection" class. It should have an array of Books.
3+
// Add a method to add a Book to the array.
4+
// Add a method to search for the price of a book given its title.
5+
// Add a method to search for the titles of all books written by a given author.
6+
// Add a method to search for the titles of all books with a price below a given amount.
7+
8+
// Make a Main class that creates a Bookstore object and tests all the methods.
9+
210
class Author
311
{
412
private String fName;
@@ -93,4 +101,8 @@ public static void main(String[] args)
93101
Book2.setPrice(735);
94102
System.out.println("Title : " + Book2.getTitle() + "\nAuthor : " + Book2.getAuthor() + "\nPrice : Rs " + Book2.getPrice());
95103
}
96-
}
104+
}
105+
106+
// Change public class Bookstore to just a class Bookstore
107+
// Make Main a `public class` with a main method that creates a Bookstore object and tests all the methods.
108+

reader/ReadingJava/Programs/Deal.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,23 @@
2525
*
2626
******************************************************************************/
2727

28+
29+
30+
// This needs to be Re-Factor'd
31+
// This is a simple program that deals 5-card hands at random to the given number of players.
32+
// It needs to be generalized, so that it can be used for any number of players and any number of cards per player.
33+
// Also the blocks of code in `main` should be broken down into methods.
34+
// the code is not well-organized, and it is not clear what the code does.
35+
// the SUITS and RANKS arrays should be declared as constants. And outside of the main method.
36+
37+
2838
public class Deal {
2939
public static void main(String[] args) {
3040
int CARDS_PER_PLAYER = 5;
3141

3242
// number of players
3343
int PLAYERS = Integer.parseInt(args[0]);
44+
// what does this ^^^^ mean?
3445

3546
String[] SUITS = {
3647
"Clubs", "Diamonds", "Hearts", "Spades"

0 commit comments

Comments
 (0)
X Tutup