Answered step by step
Verified Expert Solution
Link Copied!

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... 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

Building Java Programs A Back To Basics Approach

Authors: Stuart Reges, Marty Stepp

5th Edition

013547194X, 978-0135471944

More Books

Students also viewed these Programming questions

Question

Explain the benefits of visualization. Critical T hinking

Answered: 1 week ago

Question

What is the shape of the exponential distribution?

Answered: 1 week ago

Question

What are the two ways to change the contents of a linked list?

Answered: 1 week ago

Question

discuss why people do or do not exercise,

Answered: 1 week ago

Question

describe how to recognize disordered eating,

Answered: 1 week ago