Control - Conditionals
IfExamples.java
Condition.java
Bunny.java.
Deitel 4.1-4.7
Part A
☑ Add new class, Collector, which has an int instance variable collected, to keep track of how many of something they collected, another available, for how many of that thing exist, and a boolean completist, which is true if we want to collect everything, or false if we don't care about having the complete set. ☑ Write a toString for this class as follows: If there are more objects collected than are available, the result should be something likean overflowing collection with 20 out of 15 items
if there are exactly the same number collected as available
a perfect collection with 15 out of 15 itemsif there are fewer collected than are available, it depends whether we are being completist, so either
a sadly incomplete collection with 10 out of 15 itemsor
a collection with 10 out of 15 items☑ [EC +10] Actually, if the number available is 0, no matter how many are collected, the result should be
not really a collection at all
adjust your toString accordingly
☑ In your main, create several Collectors with different values and check that their toStrings come out correctlyPart B
Create another class OrderNums, also with a main. We will be using the Scanner class to read from the user. At the top, after the package statement, pasteimport java.util.Scanner;As the first line inside your main method, paste
Scanner scan = new Scanner(System.in);☑ In main, ask the user for a value for each of three int variables x, y, and z. ☑ Using conditionals with logical operators, print the three ints back out in decreasing order. (You can ignore the case where two numbers are the same) So whether you were given 2, 1, 3, or 1,2,3 or 3,1,2, you'd print out 3, 2, 1. You may add extra variables (i.e. small, med, and large) if you wish. Make sure you test all possible orders for the three numbers.