Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q5 & Q6 (58 pts) Assume characters is a table of strings. It has 3 columns: Name, animal type and color, as in the sample

image text in transcribed
image text in transcribed
Q5 & Q6 (58 pts) Assume characters is a table of strings. It has 3 columns: Name, animal type and color, as in the sample data below. Write the following methods Peppa pig Pink brown white cat tabby rabbit white a) W'rite a method that takes the characters table and a color and returns the count of animals that have that color. For the above data and color "white" it will return 2 because two animals (Suzy and Rebecca) are white. b) Write a method that takes the characters table and a char and returns an array List of all the strings that have that character in them. The check should be case insensitive. For the above data and char'd' it will return "dog", "Candy"]. If there is no string with that char, it should return an empty list (of size 0) c) Practice with all 4 possible representations of the characters table - 2D array of strings, - ArrayList of ArrayLists of strings - ArrayList of arrays of strings av/pid-7744959-dt-content-rid-136402286 2/ /2188-INTRO-COMPUTERS PROGRAMMING8. a) Write a method that takes the characters table and a color and returns the count of animals that have that color. For the above data and color "white" it will return 2 because two animals (Suzy and Rebecca) are white. b) Write a method that takes the characters table and a char and returns an arrayList of all the strings that have that character in them. The check should be case insensitive. For the above data and char 'd' it will return [Danny", "dog", "Candy"]. If there is no string with that char, it should return an empty list (of size 0). c) Practice with all 4 possible representations of the characters table: -2D array of strings, - ArrayList of ArrayLists of strings - ArrayList of arrays of strings -array of ArrayLists of strings Note that only a small part of your code should change for each representation. d) Which of the above structures would you use, if you had to support the following modifications to the characters table: add and/or remove rows from the table, - given an animal name such as "Candy" and a color such as "red", update that animal's color in the table. So tabby" would be replaced with 'red" in the table

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Are extensive disclosures required for deferred taxes? Explain.

Answered: 1 week ago

Question

=+What is their probable reaction to your message?

Answered: 1 week ago