Katherine Kahla
CompSci 125 001
HW3
3.7. Write code to declare and instantiate an object of the Random class (call the object reference
variable rand). Then write a list of expressions using the nextInt method that generates random
numbers in the followin
Katherine Kahla
CompSci 125 001
HW2
2.10. Given the following declarations, what result is stored in each f the listed assignment
statements?
a. 5
b. 5.0
c. 3
k. 3
l. 3.0
m. 0.0
q. 0
2.11. For each of the following expressions, indicate the order in which
1.5. If a language uses 240 unique letters and symbols, how many bits would be needed to store
each character of a document? Why?
You would need 2^8 bits because to represent 240 unique letters and symbols you need at
least 240 bits and the smallest 2^N i
Java Software Solutions, 6th Edition
Exercise Solutions, Ch. 10
Chapter 10 Exercise Solutions
EX 10.1. Create a UML class diagram for the ProductCodes program.
EX 10.2. What would happen if the try statement were removed from the level1 method of the Exce
Java Software Solutions, 6th Edition
Exercise Solutions, Ch. 9
Chapter 9 Exercise Solutions
EX 9.1. Draw and annotate a class hierarchy that represents various types of faculty at a university. Show what characteristics would be represented in the various
Java Software Solutions, 6th Edition
Exercise Solutions, Ch. 8
Chapter 8 Exercise Solutions
EX 8.1. Draw a UML class diagram showing an inheritance hierarchy containing classes that represent different types of clocks. Show the variables and method names
Java Software Solutions, 6th Edition
Exercise Solutions, Ch. 7
Chapter 7 Exercise Solutions
EX 7.1. Which of the following are valid declarations? Which instantiate an array object? Explain your answers. int primes = cfw_2, 3, 4, 5, 7, 11; Invalid; an int
Java Software Solutions, 6th Edition
Exercise Solutions, Ch. 6
Chapter 6 Exercise Solutions
EX 6.1. Write a method called average that accepts two integer parameters and returns their average as a floating point value. public double average (int num1, int
Java Software Solutions, 6th Edition
Exercise Solutions, Ch. 5
Chapter 5 Exercise Solutions
EX 5.1. What happens in the MinOfThree program if two or more of the values are equal? If exactly two of the values are equal, does it matter whether the equal val
Java Software Solutions, 6h Edition
Exercise Solutions, Ch. 4
Chapter 4 Exercise Solutions
EX 4.1. For each of the following pairs, which represents a class and which represents an object of that class?
a. Superhero, Superman Class: Superhero, Object: Sup