Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the method you wrote in question 10 so it performs a caseinsensitive test. The method should return true if the argument ends with .com

Modify the method you wrote in question 10 so it performs a caseinsensitive test. The method should return true if the argument ends with .com in any possible combination of uppercase and lowercase letters.

method that i wrote for 10

public class methodIJustWrote { public static boolean DotCom(String input) { if (input.endsWith(".com")) { return true; } return false; }

public static void main(String[] args) { //Create a string object and initialize its value. String str = "Rachel12Green@live.com"; //If the value returned by the call to the function //endsWithDotCom() by passing the input string is //true, then display an appropriate message showing //that string ends with .com. if(DotCom(str)) { System.out.println("String " + str + " ends with \".com\"!"); } //Otherwise, display an appropriate message showing //that string doesn't end with .com. else { System.out.println("String " + str + " does not end with \".com\"!"); } } }

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

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

5. Macro consumers of health care are government and insurers.

Answered: 1 week ago