Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A. Write a method named mysteryWord that accepts a single integer parameter and returns a String of that length with random (upper case) characters.
A. Write a method named mysteryWord that accepts a single integer parameter and returns a String of that length with random (upper case) characters. (Hint: (char)65 is 'A' and (char)90 is 'Z'). Example use shown below. B. Write a method named countOf9 that accepts a single integer parameter and returns the count of number of times digit 9 appears in that integer. For example, countOf9(23969) will return 9 whereas countOf9(8757) will return 0. Make sure your code works for single digit as well as negative numbers correctly. You are not allowed to convert the number to a string and use any string methods. Reminder: Class name, and correct 1,2,3 (return, name, parameters) for each method is the best place to start!!! Here's a main() method for Quiz5.java that will work if you do this correctly: public static void main(String[] args) { } String thing mysteryWord(4); System.out.println(thing); // "SDTL" on my first test do { thing mysteryWord (4); } while (!thing.equals("SURE")); System.out.println(thing); // ultimately I get "SURE" System.out.println("countOf9 in 45894399 is " + count0f9 (45894399)); //Should be 3 System.out.println("countOf9 in 424 is " + count0f9 (424)); //Should be System.out.println("countOf9 in -919199 is " + countOf9(-919199)); //Should be 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Here are the methods mysteryWord and countOf9 java import javautilRandom public class Quiz5 Method t...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started