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: 42% (7 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)).
-
Interview a manager to discover what that person believes to be the five most important status symbols in the work situation. Identify whether the importance of status symbols is increasing or...
-
An excerpt from the financial statement of Lombardy Services follows. The information refers to a single note receivable. 1997 1996 Balance Sheet Note receivable $20,000 $20,000 Less: Discount on...
-
Eve Dalton is the new controller for Smashing Hits, a designer and manufacturer of tennis attire. Shortly before the December 31 fiscal year- end, Liz Sinclair (the company president) asks Dalton how...
-
Tom paid $60,000 to Dick for 75% of Dick's interest in the DH Partnership. At that time, Dick's capital balance was $90,000. The entry to record Tom's admission to the partnership would include O a...
-
A consulting firm specializing in agriculture determines that the following combinations of hay and grain consumption per lamb will result in a 25- pound gain for a lamb: a. The firm's president...
-
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...
-
The interest rate at which London banks lend money to one another is called the London interbank offered rate, or Libor. The British Bankers Association regularly surveys international banks for the...
-
Fila a memo with this tax problem. Three factors need to be considered for this memo: ( 1 ) Identification of the relevant authority ( finding the key Code sections, regulations, rulings, cases,...
-
My current position and some that were prior to this one offer 401K plan benefits and my current position does 100% matching on investment up to six percent I believe. This means that for every six...
-
Kaleen(Pty) Ltd, a Gauteng-based company that sells bottled water, wants to build a storage warehouse in Cape Town to store its products and launch distribution in Cape Town. The storage warehouse...
-
Proponents of this view argue that an unequal distribution of rewards, such as higher incomes or profits, can provide individuals with incentives to work harder, invest, and take risks. The prospect...
-
Do you believe that people should have the right to publicly practice their religion in the workplace environment or should religious practices be separate from the work environment? Why or why not?...
-
Contact a charity and ask how people are about fulfilling their pledges. Ask if the charity relies on the pledges or waits to get the money before budgeting expenditures and what steps, including...
-
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...
-
Failing states are a major problem for the the entire global community of nation-states. Why are failing states such a concern and how should countries like the United States, with both hard and soft...
-
Explain which of all the financial statements (balance sheet, income statement, cash flow statement, statement of equity, etc) is the most suitable for these three; shareholders, investor and...
-
What three options does a buyer have with non-conforming goods?
Study smarter with the SolutionInn App