Question: In Java Program 1: Create an array of Strings with following: String[] names = {bob, jen, rob, rick}; Write the following method: public static int
![In Java Program 1: Create an array of Strings with following: String[]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66fa69892feb2_04866fa6988ba1ab.jpg)
In Java
Program 1: Create an array of Strings with following: String[] names = {"bob", "jen", "rob", "rick"}; Write the following method: public static int amtOfPattern(String[] n, String pattern) amtOfPattern returns back the total amount of String in the array n that contain the pattern in String pattern. example: amtOfPattern(names,"ob"); //returns 2 amtOfPattern(names,"xx"); //returns 0 Program 2: 1) Create a class called Horse with following: a) an instance var to store the weight of the horse object (int) b) two constructors: one to set weight, one default.. default weight is 900 c) accessor and mutator method for weight d) toString method -- simply prints out the weight of horse object In Main Method create the following Horse Array: a) create an array of Horse object length is four, called myStable b) for each element (Horse object) in myStable set the following four weight 1000, 900, 800, 1400 (create Horse Object for each element in myStable) c) create a method public static int amtOfBigHorses(Horse[] h, int w); returns back a total of all Horse objects > 999 pounds above should return back a total of 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
