Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java please 1. Write a method named countOccurrences. The method receives a character and a String and returns an int. The method returns the

image text in transcribed

In Java please

1. Write a method named countOccurrences. The method receives a character and a String and returns an int. The method returns the number of times that the received character is found in the received String, case insensitive method signature: public static int countOccurrences(char ch, String word) Example values: countOccurrences('a', "bcaabc") should return 2 countOccurrences('f, "bca") should return 0 countOccurrences('a', "bbbAccc") should return 1 2. Write a method named toCentimeters, the method receives a double, which is number of inches and returns the equivalent centimeters for the receive inches. (Look up a conversion formula, be sure that you use double type values in your formula). method signature: public static double to Centimeters(double inches) Example values: toCentimeters(1.0) should return 2.54 to Centimeters(36.0) should return 91.44 toCentimeters(100.0) should return 254.0 to Centimeters(-100.0) should return -254.0 3. Write a method named getLetterGrade. The method receives a grade average (double) returns the corresponding letter grade - use 90.0,80.0,70.0.60.0 as cutoffs for A, B, C, D, F. Any grade average received that is below 0.0 or over 105.0 return 'X' method signature: public static char getLetterGrade(double gradeAvg) Example values: getLetterGrade(90.0) should return 'A' getLetterGrade(85.2) should return 'B' getLetterGrade(69.9) should return 'D' getLetterGrade(78.33) should return 'C' getLetterGrade(110.0) should return 'X' getLetterGrade(104.3) should return 'A

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