Use the methods in RandomCharacter in Listing 6.10 to print 100 uppercase letters and then 100 single
Question:
Use the methods in RandomCharacter in Listing 6.10 to print 100 uppercase letters and then 100 single digits, printing ten per line.
Transcribed Image Text:
LISTING 6. 10 RandomCharacter.java 1 public class RandomCharacter { /** Generate a random character between ch1 and ch2 */ public static char getRandomCharacter (char ch1, char ch2) { return (char) (ch1 + Math.random () * (ch2 - ch1 + 1)); } 2 3 4 5 /** Generate a random lowercase letter */ public static char getRandomLowerCaseLetter) { return getRandomCharacter('a', 'z'); } 7 8 10 11 /** Generate a random uppercase letter */ public static char getRandomUpperCaseLetter() { return getRandomCharacter('A', 'Z'); } 12 13 14 15 16 /** Generate a random digit character */ public static char getRandomDigitCharacter () { return getRandomCharacter('0', '9'); } 17 18 19 20 21 /** Generate a random character */ public static char getRandomCharacter() { return getRandomCharacter('\u0000', '\UFFFF'); } 22 23 24 25 26 }
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 50% (6 reviews)
Program This Program demonstrates an interactive approach that generates random upper case characters and random digits Note Refer the text book for t...View the full answer
Answered By
Albert Kinara
i am an expert research writer having worked with various online platform for a long time. i also work as a lecturer in business in several universities and college part time and assure you well researched and articulate papers. i have written excellent academic papers for over 5 year and have an almost similar experience experting many clients in different units. bachelor of commerce (finance)
masters in strategic management
phd finance
4.60+
26+ Reviews
48+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Rewrite the Rational class in Listing 13.13 using a new internal representation for the numerator and denominator. Create an array of two integers as follows:private long[] r =?new long[2];Use r[0]...
-
The MyLinkedList class used in Listing 24.6 is a one-way directional linked list that enables one-way traversal of the list. Modify the Node class to add the new data field name previous to refer to...
-
Rewrite the Course class in Listing 10.6. Use an ArrayList to replace an array to store students. Draw the new UML diagram for the class. You should not change the original contract of the Course...
-
Modify HashST to use a resizing array so that the average length of the list associated with each hash value is between 1 and 8 .
-
Suppose that f (x), g(x), and h(x) are functions such that f (x) is O(g(x)) and g(x) is O(h(x)). Show that f (x) is O(h(x)).
-
In Exercises find the limit (if it exists). If it does not exist, explain why. lim (2-[-x]) x3
-
What does a rate earned on average total assets show?
-
Owen, Inc. manufactures bookcases and uses an activity-based costing system. Owens activity areas and related data follow: Owen produced two styles of bookcases in October: the standard bookcase and...
-
Equipment costs can be both variable and fixed. False,True Correct
-
The Western Outfitters Store specializes in denim jeans. The variable cost of the jeans varies according to several factors, including the cost of the jeans from the distributor, labor costs,...
-
Watkins Enterprises earned net income of $95,000 during the year ended December 31, 2018. On December 15, 2018, Watkins Enterprises declared the annual cash dividend on its 2 percent preferred stock...
-
A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for...
-
What is management by exception? What criteria may be used in identifying exceptions?
-
Why might auditors use program code comparison when evaluating the quality of a program?
-
Briefly explain the nature of McCabe's cyclomatic complexity number. How is it useful to auditors in their work?
-
Briefly explain the nature of loop testing as a test-data design method. List the steps auditors should undertake to test whether there are errors in a simple loop.
-
Briefly explain how auditors can use production data to create test data. Is production data sometimes still useful even though it does not meet exactly the test-data design specifications?
-
What factors affect whether auditors use a reduced form or an unreduced form of a decision table to design test data for audit evidence-collection purposes? If auditors base their test-data design on...
-
Evaluate the following statement: Business is war. Never consort with the enemy.
-
Refer to the table to answer the following questions. Year Nominal GDP (in billions) Total Federal Spending (in billions) Real GDP (in billions) Real Federal Spending (in billions) 2000 9,817 578...
-
Rewrite Exercise 39.1 to handle large factorial as shown in Figure 39.32. Use the BigInteger class introduced in Section 10.9. Data from Exercise 39.1 Write a JSF page that displays a factorial page...
-
Write a JSP for Exercise 33.1, as shown in Figure 38.17. Data from Exercise 33.1, Write a server for a client. The client sends loan information (annual interest rate, number of years, and loan...
-
Write a JSF that prompts the user to enter a capital for a state, as shown in Figure 39.34a. Upon receiving the user input, the program reports whether the answer is correct, as shown in Figure...
-
Growth Option: Option Analysis Fethe's Funny Hats is considering selling trademarked, orange-haired curly wigs for University of Tennessee football games. The purchase cost for a 2-year franchise to...
-
(A) define loan-to-value ratio (LVR) and illustrate with a specific example (B) provide reasons why APRA has cracked down on high debt-to-income (DTI) and high LVR lending
-
Suppose that the interest rates in Norway and the US are, respectively, 8 % and 4 % . Suppose that the spot price of the Norwegian Kroner is $ 0 . 1 5 5 . A three - month forward contract on...
Study smarter with the SolutionInn App