Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Program 1: Create an array of Strings with following: String[] names = {bob, jen, rob, rick}; Write the following method: public static int

image text in transcribedimage text in transcribedIn 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions