All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Study Help
New
Search
Search
Sign In
Register
study help
computer science
java software solutions
Questions and Answers of
Java Software Solutions
EX 3.8 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
EX 3.9 Write an assignment statement that computes the square root of the sum of num1 and num2 and assigns the result to num3.
EX 3.10 Write a single statement that computes and prints the absolute value of total.
EX 3.11 Write code statements to create a DecimalFormat object that will round a formatted value to four decimal places. Then write a statement that uses that object to print the value of result,
EX 3.12 Write code statements that prompt for and read a double value from the user, and then print the result of raising that value to the fourth power. Output the results to three decimal places.
EX 3.13 Write a declaration for an enumerated type that represents the days of the week.
EX 3.14 Compare and contrast a traditional coordinate system and the coordinate system used by Java graphical components.
EX 3.15 Write a declaration for each of the following: a. A line that extends from point (60, 100) to point (30, 90). b. A rectangle that is 20 pixels wide, 100 pixels high, and has its upper-left
EX 3.16 Are the following lines horizontal, vertical, or neither? a. new Line (30, 90, 30, 10) b. new Line (85, 70, 70, 85) C. new Line (20, 40, 150, 40)
EX 3.17 Is each of the following ellipses wider than it is tall or taller than it is wide? a. new Ellipse (300, 100, 50, 10) b. new Ellipse (100, 200, 20, 40) C. new Ellipse (150, 220, 60, 30)
EX 3.18 How do you make a shape that has no fill color, so that you can see the elements behind it?
EX 3.19 Write a line of code that rotates an ellipse called myEllipse 45 degrees clockwise.
SR 3.1 What is a null reference?
SR 3.2 What does the new operator accomplish?
SR 3.3 Write a declaration for a String variable called author, and initialize it to the string "Fred Brooks". Draw a
SR 3.4 Write a code statement that sets the value of an integer variable called size to the length of a string object called name.
SR 3.5 What is an alias? How does it relate to garbage collection?
SR 3.6 Assume s1, s2, and 33 are String variables initialized to "Amanda", "Bobby", and "Chris", respectively. Which String variable or variables are changed by each of the following statements? a.
SR 3.7 What output is produced by the following code fragment? String sl = "Foundations"; String s2; System.out.println(sl.charAt(1)); s2 = sl.substring(0, 5); System.out.println(s2);
SR 3.8 Write a statement that prints the value of a String object called title in all uppercase letters.
SR 3.9 Write a declaration for a String variable called front, and initialize it to the first 10 characters of another String object called description.
SR 3.10 What is a Java package?
SR 3.11 What does the java.net package contain? The javafx.scene.shape package?
SR 3.12 What package contains the Scanner class? The String class? The Random class? The Math class?
SR 3.13 Using the online Java API documentation, describe the Point class.
SR 3.14 What does an import statement accomplish?
SR 3.15 Why doesn't the string class have to be specifically imported into our programs?
SR 3.16 Given a Random object called rand, what does the call rand.nextInt() return?
SR 3.17 Given a Random object called rand, what does the call rand.nextInt (20) return?
SR 3.18 Assuming that a Random object has been created called generator, what is the range of the result of each of the following expressions? a. generator.nextInt(50) b. generator.nextInt(5) + 10 C.
SR 3.19 Assuming that a Random object has been created called generator, write expressions that generate each of the following ranges of integers, including the endpoints. Use the version of the
SR 3.20 What is a class method (also called a static method)?
SR 3.21 What is the value of each of the following expressions? a. a. Math.abs (10) + Math.abs (-10) b. b. Math.pow(2, 4) C. c. Math.pow(4, 2) d. d. Math.pow(3, 5) e. e. Math.pow(5, 3) f. f.
SR 3.22 Write a statement that prints the sine of an angle measuring 1.23 radians.
SR 3.23 Write a declaration for a double variable called result and initialize it to 5 raised to the power 2.5.
SR 3.24 Using the online Java API documentation, list three methods of the Math class that are not included in Figure 3.5
SR 3.25 Describe how you request a NumberFormat object for use within a program.
SR 3.26 Suppose that in your program you have a double variable named cost. You want to output the value stored in cost formatted as the currency of the current locale. a. Write a code statement that
SR 3.27 What are the steps to output a floating point value as a percentage using Java's formatting classes?
SR 3.28 Write code statements that prompt for and read in a double value from the user, and then print the result of taking the square root of the absolute value of the input value. Output the result
SR 3.29 Write the declaration of an enumerated type that represents movie ratings.
SR 3.30 Suppose that an enumerated type called CardSuit has been defined as follows: enum CardSuit (clubs, diamonds, hearts, spades} What is the output of the following code sequence? CardSuit cardl,
SR 3.31 Why use an enumerated type such as CardSuit defined in the previous question? Why not just use string variables and assign them values such as "hearts"?
SR 3.32 How can we represent a primitive value as an object?
SR 3.33 What wrapper classes correspond to each of the following primitive types: byte, int, double, char, and boolean?
SR 3.34 Suppose that an int variable named number has been declared and initialized and an Integer variable named holdNumber has been declared. Show two approaches in Java for having holdNumber
SR 3.35 Write a statement that prints out the largest possible int value.
SR 3.36 In what situation might you omit the main method in a JavaFX application?
SR 3.37 What is a stage in the JavaFX theatre metaphor?
SR 3.38 What does the root node of a scene contain?
SR 3.39 Describe where the point (20, 50) is in the Java coordinate system.
SR 3.40 How do you make one shape appear in front of another?
SR 3.41 Write a declaration for a Rectangle that is 100 pixels wide, 200 pixels high, with its upper-left corner positioned at point (30, 20).
SR 3.42 Is the ellipse defined in the following statement wider than it is tall or taller than it is wide? Ellipse ellipse = new Ellipse (100, 150, 70, 90);
SR 3.43 What is the effect of calling setFill on a Circle object, passing it a parameter of null?
SR 3.44 What is the advantage of grouping particular elements in a scene?
SR 3.45 What is an RGB value?
SR 3.46 Write a statement to create a Color object equivalent to Color. PINK using the rgb method.
SR 3.47 Write a statement to create a Color object equivalent to Color.YELLOW using the color method.
PP 3.1 Write a program that prompts for and reads the user's first and last name (separately). Then print a string composed of the first letter of the user's first name, followed by the first five
PP 3.2 Write a program that prints the sum of cubes. Prompt for and read two integer values and print the sum of each value raised to the third power.
PP 3.3 Write a program that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the output. Do not let the first three digits contain an 8 or 9 (but don't be more
PP 3.4 Write a program that reads a floating point value (double) and prints the closest whole numbers less than and greater than that value. For example, if the number is 28.466, the program would
PP 3.5 Write a program that reads the (x,y) coordinates for two points. Compute the distance between the two points using the following formula:
PP 3.6 Write a program that reads the radius of a sphere and prints its volume and surface area. Use the following formulas. Print the output to four decimal places. r represents the radius.
PP 3.7 Write a program that reads the lengths of the sides of a triangle from the user. Compute the area of the triangle using Heron's formula (below), in which s represents half of the perimeter of
PP 3.8 Write a program that generates a random integer in the range 20 to 40, inclusive, and displays the sine, cosine, and tangent of that number.
PP 3.9 Write a program that generates a random integer radius (r) and height (h) for a cylinder in the range 1 to 20, inclusive,
PP 3.10 Revise the Snowman application in the following ways: Add a third button. Move the sun to the upper-right side of the picture. Display your name in the upper-left corner of the picture.
PP 3.11 Write a JavaFX application that displays the Olympic logo. The circles do not have to be linked.
PP 3.12 Write a JavaFX application that draws a house with a door and doorknob, windows, and a chimney. Add some smoke coming out of the chimney and some clouds in the sky.
PP 3.13 Write a JavaFX application that draws a circle centered at point (200, 200) with a random radius in the range 50 to 150. Each time the program is run it will draw a different circle.
PP 3.14 Write a JavaFX application that displays your name rotated at a random angle (0 to 360). Each time the program is run it will draw your name at a different angle.
PP 3.15 Write a JavaFX application that displays a rectangle filled with a random color created using the rgb method of the Color class. Each time the program is run it will display a rectangle with
PP 3.16 Write a JavaFX application that displays a depiction of a solar system with a sun and three planets. Use ellipses to show the orbits of the planets around the sun.
SR 4.1 What is an attribute?
SR 4.2 What is an operation?
SR 4.3 List some attributes and operations that might be defined for a class called Book that represents a book in a library.
SR 4.4 True or False? Explain. a. We should use only classes from the Java standard class library when writing our programsthere is no need to define or use other classes. b. An operation on an
SR 4.5 What is the difference between an object and a class?
SR 4.6 Describe the instance data of the Die class.
SR 4.7 Which of the methods defined for the Die class can change the state of a Die objectthat is, which of the methods assign values to the instance data?
SR 4.8 What happens when you pass an object to a print or println method?
SR 4.9 What is the scope of a variable?
SR 4.10 What are UML diagrams designed to do?
SR 4.11 Objects should be self-governing. Explain.
SR 4.12 What is the interface to an object?
SR 4.13 What is a modifier?
SR 4.14 Why might a constant be given public visibility?
SR 4.15 Describe each of the following: a. public method b. private method c. public variable d. private variable
SR 2.21 What is the result of 1985 when evaluated in a Java expression? Explain.
SR 2.22 What is the result of 13/4 when evaluated in a Java expression? Explain.
SR 2.23 If an integer variable diameter currently holds the value 5, what is its value after the following statement is executed? Explain. diameter diameter 4;
SR 2.24 What is operator precedence?
SR 2.25 What is the value of each of the following expressions? a. 157 3 b. (157) * 3 C. 3 3610 / 5+ 5 d. 275 +7 % 3 e. 100/2/2/2
SR 2.26 For each of the following expressions state whether they are valid or invalid. If invalid, explain why. a. result = ( 5 + 2 ) ; b. result = ( 5 + 2 + ( 15 - 3 ); (5 +2 C. result = ( 5 + 2 (;
SR 2.27 What value is contained in the integer variable result after the following sequence of statements is executed? result = 27; result = result + 3; result = result / 7; result = result * 2;
SR 2.28 What value is contained in the integer variable result after the following sequence of statements is executed? int base; int result; base = 5; result = base + 3; base = 7;
SR 2.29 What is an assignment operator?
SR 2.30 If an integer variable weight currently holds the value 100, what is its value after the following statement is executed? Explain. weight 17;
Showing 600 - 700
of 978
1
2
3
4
5
6
7
8
9
10