Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions from your teacher: Complete the same static method of the Problem class. There are 3 string parameters: x, y, z. The method returns true

image text in transcribedimage text in transcribed

Instructions from your teacher: Complete the same static method of the Problem class. There are 3 string parameters: x, y, z. The method returns true if the string y occurs the same number of times in string x as string z occurs in x. La Main.java Problem.java: 1 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner( system.in); System.out.println("Enter a string:"); String a = scan.nextLine(); a = a.toLowerCase(); System.out.println("Enter a string:"); String b = scan.nextLine(); b = b.toLowerCase(); System.out.println("Enter a string:"); String c = scan.nextLine(); C = c.toLowerCase(); 2 3 4 - 5 6 - 7 8 9 10 11 12 13 14 15 16 17 Here is a sample run: Enter a string: nothing there Enter a string: th Enter a string: n true It prints true at the end because "th" appears twice in "nothing there and n appears twice in "nothing there" as well. // call the same method and print the returned value. Complete the count method and use this is completing the same method. Do not count overlapping strings. For example, if c = "RRR" and d = "RR" then the method should return 1. java version "1.8.0_31" Java (TM) SE Runtime Environment (build 1. 8.0_31-b13) Java HotSpot (TM) 64-Bit Server VM (build 25. 31-b07, mixed mode) ? Complete the main method and test your solution prior to submitting. (5 points) Main.java Problem.java: public class Problem { private Problem() { } public static boolean same string x, String y, string z ) { return true; } 1* count returns the number of times string d appears in string c. DO NOT count overlapping strings. */ public static int count( String c, String d ) { return 0; } }

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_2

Step: 3

blur-text-image_3

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

Students also viewed these Databases questions

Question

5. Develop the succession planning review.

Answered: 1 week ago