Package Explorer X Lab1Sol lab2Sol JRE System Library [JavaSE-17] src cus1156fall2022lab2 J Cat.java JCatList.java CatListSortTest.java Practice...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Package Explorer X Lab1Sol lab2Sol JRE System Library [JavaSE-17] src cus1156fall2022lab2 J Cat.java JCatList.java CatListSortTest.java Practice Week1 Week2 Week3 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 160 18991 17 19 20 21 22 23 24 25 26 27 28 29 300 31 32 33 34 350 36 37 38 390 40 41 1 42 43 44 45 46 47 480 BankAccount.jav 49 50 51 52 53 54 55 56 57- 58 59 60 61 62- 63 64 65 66 67 68 690 70 71 2 73 74 75 76 7 78 79 72 740 77 J T } /** *This class represents a cat * @author Bonnie K. MacKellar */ public class Cat { private String name; private String color; BankAccount Test /** * create a default cat */ public public Cat () { /** * create a cat of a given name and color * * @param name - the cat's name * @param color the cat's color. */ public Cat (String name, String color) { this.name = name; this.color = color; } /** * get the cat's color * * @return the color */ public String getColor() { return color; } /** * set the cat's color * * @param color color of the cat */ public void setColor (String color) { this.color = color; } /** * get the cat's name * * @return the cat's name */ public String getName() { return name; } /** * set the cat's name * * @param name */ public void setName(String name) { this.name = name; } } /** * make the cat meow banktester.java */ public void meow () { System.out.println("Hi, my name is " + name); System.out.println("Meow!"); public String toString() { return "Cat [name=" + name + ", color=" + color + "]"; } Writable Hamster.java Smart Insert HamsterFun.java 1:1:0 J Comparator Lambd JCat.java X 48 Q 8 22 0 4 + 29 4 Tok D Package Explorer X Lab1Sol lab2Sol JRE System Library [JavaSE-17] src cus1156fall2022lab2 JCat.java JCatList.java CatListSortTest.java Practice Week1 Week2 Week3 0 222G BankAccount.jav 1 125678 60 /** * Represents a list of cats * 9 * @author Bonnie MacKellar 10 * 11 */ 12 public class CatList { 13 14 150 16 17 18 19 200 21 22 23 240 25 26 27 28 2 import java.util.ArrayList; 4567 OSONM 33 290 30 31 1234O 32 330 34 35 36 37 380 39 40 41 69 420 43 45 44 45 A460 47 48 49 50 51 52 53 540 BFSGFWN T 55 56 57 } 58 BankAccount Test } private ArrayList cats = new ArrayList (); /** * add one cat to the list, at the last position * * @param cat a Cat to be added */ public void addCat (Cat cat) { cats.add(cat); /** * return the number of cats in the list * * @return number of cats in the list */ public int howManyCats () { return cats.size(); } banktester.java /** * return the cat at the ith position * * @param pos the position whose Cat we want to return */ public Cat getCatAtPos(int pos) { return cats.get(pos); } } } /** * return a formatted string containing cat information for all the cats on the * list */ public String toString() { String newline = System.getProperty("line.separator"); String str = ""; for (Cat currCat : cats) Hamster.java str + currCat + newline; return str; Writable Comparator Lambd public List getCats ByColor (String color) { return (cats.stream().filter (cat -> cat.getColor().equals(color)).collect (Collectors.toList())); Smart Insert JCat.java 27:25: 489 CatList.java X 49 Q 8 22 0 W 43 Tok D Package Explorer X Lab1Sol lab2Sol JRE System Library [JavaSE-17] src cus1156fall2022lab2 J Cat.java JCatList.java CatListSortTest.java Practice Week1 Week2 Week3 1 L2345STOSANASSAB9OANELE BankAccount.jav 1 6 3 public class CatListSortTest { 7 8 10 11 50 public static void main(String[] args) { CatList cats = new CatList(); System.out.println("will create the cats"); cats.addCat (new Cat ("Fluffy", "gray")); cats.addCat (new Cat ("Zoe", "black")); cats.addCat (new Cat ("Xiongmao", "spotted")); cats.addCat (new Cat ("Little Kitty", "calico")); cats.addCat (new Cat ("Angus", "gray")); 12 13 14 15 222 16 17 18 19 20 21 22 J 24 25 } T 26 BankAccount Test } banktester.java JComparatorLambd System.out.println("Here is the list"); System.out.println(cats); "I System.out.println("There are + cats.howManyCats () + /* ArrayList sorted Cats = cats.getCats SortedByName(); System.out.println("Here are the sorted cats"); System.out.println(sorted Cats); System.out.println("Here is the original list");*/ System.out.println(cats); Writable Smart Insert Cat.java cats on the list"); 1:1:0 JCatList.java JCatListSortTest X >> 50 Q 8 22 U 4 + 43 Tok D Package Explorer X Lab1Sol lab2Sol JRE System Library [JavaSE-17] src cus1156fall2022lab2 J Cat.java JCatList.java CatListSortTest.java Practice Week1 Week2 Week3 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 160 18991 17 19 20 21 22 23 24 25 26 27 28 29 300 31 32 33 34 350 36 37 38 390 40 41 1 42 43 44 45 46 47 480 BankAccount.jav 49 50 51 52 53 54 55 56 57- 58 59 60 61 62- 63 64 65 66 67 68 690 70 71 2 73 74 75 76 7 78 79 72 740 77 J T } /** *This class represents a cat * @author Bonnie K. MacKellar */ public class Cat { private String name; private String color; BankAccount Test /** * create a default cat */ public public Cat () { /** * create a cat of a given name and color * * @param name - the cat's name * @param color the cat's color. */ public Cat (String name, String color) { this.name = name; this.color = color; } /** * get the cat's color * * @return the color */ public String getColor() { return color; } /** * set the cat's color * * @param color color of the cat */ public void setColor (String color) { this.color = color; } /** * get the cat's name * * @return the cat's name */ public String getName() { return name; } /** * set the cat's name * * @param name */ public void setName(String name) { this.name = name; } } /** * make the cat meow banktester.java */ public void meow () { System.out.println("Hi, my name is " + name); System.out.println("Meow!"); public String toString() { return "Cat [name=" + name + ", color=" + color + "]"; } Writable Hamster.java Smart Insert HamsterFun.java 1:1:0 J Comparator Lambd JCat.java X 48 Q 8 22 0 4 + 29 4 Tok D Package Explorer X Lab1Sol lab2Sol JRE System Library [JavaSE-17] src cus1156fall2022lab2 JCat.java JCatList.java CatListSortTest.java Practice Week1 Week2 Week3 0 222G BankAccount.jav 1 125678 60 /** * Represents a list of cats * 9 * @author Bonnie MacKellar 10 * 11 */ 12 public class CatList { 13 14 150 16 17 18 19 200 21 22 23 240 25 26 27 28 2 import java.util.ArrayList; 4567 OSONM 33 290 30 31 1234O 32 330 34 35 36 37 380 39 40 41 69 420 43 45 44 45 A460 47 48 49 50 51 52 53 540 BFSGFWN T 55 56 57 } 58 BankAccount Test } private ArrayList cats = new ArrayList (); /** * add one cat to the list, at the last position * * @param cat a Cat to be added */ public void addCat (Cat cat) { cats.add(cat); /** * return the number of cats in the list * * @return number of cats in the list */ public int howManyCats () { return cats.size(); } banktester.java /** * return the cat at the ith position * * @param pos the position whose Cat we want to return */ public Cat getCatAtPos(int pos) { return cats.get(pos); } } } /** * return a formatted string containing cat information for all the cats on the * list */ public String toString() { String newline = System.getProperty("line.separator"); String str = ""; for (Cat currCat : cats) Hamster.java str + currCat + newline; return str; Writable Comparator Lambd public List getCats ByColor (String color) { return (cats.stream().filter (cat -> cat.getColor().equals(color)).collect (Collectors.toList())); Smart Insert JCat.java 27:25: 489 CatList.java X 49 Q 8 22 0 W 43 Tok D Package Explorer X Lab1Sol lab2Sol JRE System Library [JavaSE-17] src cus1156fall2022lab2 J Cat.java JCatList.java CatListSortTest.java Practice Week1 Week2 Week3 1 L2345STOSANASSAB9OANELE BankAccount.jav 1 6 3 public class CatListSortTest { 7 8 10 11 50 public static void main(String[] args) { CatList cats = new CatList(); System.out.println("will create the cats"); cats.addCat (new Cat ("Fluffy", "gray")); cats.addCat (new Cat ("Zoe", "black")); cats.addCat (new Cat ("Xiongmao", "spotted")); cats.addCat (new Cat ("Little Kitty", "calico")); cats.addCat (new Cat ("Angus", "gray")); 12 13 14 15 222 16 17 18 19 20 21 22 J 24 25 } T 26 BankAccount Test } banktester.java JComparatorLambd System.out.println("Here is the list"); System.out.println(cats); "I System.out.println("There are + cats.howManyCats () + /* ArrayList sorted Cats = cats.getCats SortedByName(); System.out.println("Here are the sorted cats"); System.out.println(sorted Cats); System.out.println("Here is the original list");*/ System.out.println(cats); Writable Smart Insert Cat.java cats on the list"); 1:1:0 JCatList.java JCatListSortTest X >> 50 Q 8 22 U 4 + 43 Tok D
Expert Answer:
Related Book For
Operations management processes and supply chain
ISBN: 978-0136065760
9th edition
Authors: Lee J Krajewski, Larry P Ritzman, Manoj K Malhotra
Posted Date:
Students also viewed these programming questions
-
Write an application that runs 1,000,000 games of craps (Fig. 5.8) and answers the following questions: a) How many games are won on the first roll, second roll, , twentieth roll and after the...
-
Determine the transfer function from U(s) to Y(s) for the following block diagram. Provided are some recommended steps to take: a. Label each signal (line with arrow) b. Write the equation for each...
-
Identify for each one individually if they are Intensive, selective, or exclusive distribution Identify which distribution strategy is being used in each of the following: 1. Coca Cola products 2....
-
On January I of this year, Ikuta Company issued a bond with a face value of $100,000 and a coupon rate of 5 percent. The bond matures in three years and pays interest every December 31. When the bond...
-
What kind of financial decisions making models does nissan motors use in its capital budgeting process? Have these decisions contributed to the company's succes? why or why not? please explain in...
-
List the main categories of data quality. Do environmental indicators use all, some or none of these categories. Provide an example to support your view based on one environmental medium (e.g. water...
-
Consider a long bar of square cross section (0.8 m to the side) and of thermal conductivity 2 W/m K. Three of these sides are maintained at a uniform temperature of 300C. The fourth side is exposed...
-
1. Find the terminal point of if the initial point is (17, 6). The terminal point is (i v = 10i - 6j
-
Futoshiki is a Sudoku-like Japanese logic puzzle that is very simple, but can be quite challenging. You are given an n x n grid, and must place the numbers 1, . . . n in the grid such that every row...
-
In the professional arbitrage model , the investors who have no knowledge about the value of the assets delegate their money to the fund managers or arbitrageurs who have accurate knowledge about the...
-
An electric field E=(2.30x105 N/C, right) causes the 2.0 g ball in (Figure 1) to hang at an angle. Figure V Part A What is 8? Express your answer in degrees. 0 E 163 25 nC +2.0 g
-
How would i implement a track addnew() into my controller? The "add new" use case Implement the "add new" use case for the Track entity. Its TrackAddFormViewModel class will need SelectList...
-
Nancy has an individual RESP for her son, Matthew which was opened 8 years ago. Matthew, age 20 passed away in a motorcycle accident this year. Current RESP breakdown: Contribution: $20,000 Canada...
-
Virat landed his first job at Telus upon graduating from Concordia in December 2023. After his 3 months of probation, Virat was offered to participate in Telus' Group Registered Retirement Savings...
-
ABC Company manufactures rubber shoes. It gets its raw materials from a supplier that grants it 30 days credit. ABC purchases P2.4 million in raw materials per year. Answer the questions that follow...
-
-73 Redefined Builtin Python has a set of built-in functions, such as min, abs, and round. It also has built-in types like str, int, and flost. It is unsafe to redefine (give new definitions to)...
-
Write the statement to store the contents of the txtAge control in an Integer variable named intAge.
-
1. Put yourself in Sue McCaskeys position and prepare a detailed report to Dan Block and Ed Spriggss on managing the inventory of the EG1 51 exhaust gasket and me DB032 dove belt Be sore to present a...
-
As a hospital administrator of a large hospital, you are concerned with the absenteeism among nurses aides. The issue has been raised by registered nurses, who feel they often have to perform work...
-
Recently the Polish General Corporation, well-known for manufacturing appliances and automobile parts, initiated a $13 billon project to produce automobiles. A great deal of learning on the part of...
-
The crate, of mass \(250 \mathrm{~kg}\), hanging from a helicopter (shown in Fig. 2.74(a)) can be modeled as shown in Fig. 2.74(b). The rotor blades of the helicopter rotate at \(300 \mathrm{rpm}\)....
-
Figure 2.78 (a) shows a steel traffic sign, of thickness \(3 \mathrm{~mm}\) fixed to a steel post. The post is \(2 \mathrm{~m}\) high with a cross section \(50 \mathrm{~mm} \times 6 \mathrm{~mm}\),...
-
A flywheel is mounted on a vertical shaft, as shown in Fig. 2.76. The shaft has a diameter \(d\) and length \(l\) and is fixed at both ends. The flywheel has a weight of \(W\) and a radius of...
Study smarter with the SolutionInn App