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
SR 8.12 What does an array initializer list accomplish?
SR 8.13 Can an entire array be passed as a parameter? How is this accomplished?
SR 8.14 How is an array of objects created?
SR 8.15 Suppose team is an array of strings meant to hold the names of the six players on a volleyball team: Amanda, Clare, Emily, Julie, Katie, and Maria. a. Write an array declaration for team. b.
SR 8.16 Assume Book is a class whose objects represent books. Assume a constructor of the Book class accepts two parametersthe name of the book and the number of pages. a. Write a declaration for a
SR 8.17 What is a command-line argument?
SR 8.18 Write a main method for a program that outputs the sum of the string lengths of its first two command-line arguments.
SR 8.19 Write a main method for a program that outputs the sum of the values of its first two command-line arguments, which are integers.
SR 8.20 How can Java methods have variable-length parameter lists?
SR 8.21 Write a method called distance that accepts a multiple number of integer parameters (each of which represents the distance of one leg of a journey) and returns the total distance of the trip.
SR 8.22 Write a method called travelTime that accepts an integer parameter indicating average speed followed by a multiple number of integer parameters (each of which represents the distance of one
SR 8.23 How are multidimensional arrays implemented in Java?
SR 8.24 A two-dimensional array named scores holds the test scores for a class of students for a semester. Write code that prints out a single value that represents the range of scores held in the
SR 8.25 What is a polyline? How do we specify its shape?
SR 8.26 What is the difference between a polygon and a polyline?
SR 8.27 Why are coordinates in JavaFX stored as double values?
SR 8.28 How can you determine if the user has double clicked the mouse button?
SR 8.29 The display for Listing 8.16 shows 12 dots. What would the color of the next dot be?
SR 8.30 What modifications would be necessary to the Dots program to add more colors to the rotating set of dot colors?
EX 8.1 Which of the following are valid declarations? Which instantiate an array object? Explain your answers. int primes = (2, 3, 4, 5, 7, 11); float elapsedTimes[] = {11.47, 12.04, 11.72, 13.88);
EX 8.2 Describe five programs that would be difficult to implement without using arrays.
EX 8.3 Describe how an element in an array is accessed in memory. For example, where is myArray [25] stored in memory?
EX 8.4 Describe what problem occurs in the following code. What modifications should be made to it to eliminate the problem? int[] numbers = [3, 2, 3, 6, 9, 10, 12, 32, 3, 12, 6}; for (int count = 1;
EX 8.5 Write an array declaration and any necessary supporting classes to represent the following statements: a. students' names for a class of 25 students b. students' test grades for a class of 40
EX 8.6 Write code that sets each element of an array called nums to the value of the constant INITIAL.
EX 8.7 Write code that prints the values stored in an array called names backwards.
EX 8.8 Write code that sets each element of a boolean array called flags to alternating values (true at index 0, false at index 1, etc.).
EX 8.9 Write a method called sumArray that accepts an array of floating point values and returns the sum of the values stored in the array.
EX 8.10 Write a method called switch Them that accepts two integer arrays as parameters and switches the contents of the arrays. Take into account that the arrays may be of different sizes.
EX 8.11 Describe a program for which you would use the ArrayList class instead of arrays. Describe a program for
EX 8.12 The Dots program handles mouse click events to draw the dots. How would the program behave differently if it handled mouse pressed events instead? Mouse released events?
EX 8.13 How would you modify the JukeBox program so that it will play the new song as soon as a combo box item is selected (without having to press the Play button)?
EX 8.14 What program modifications would be necessary to add three more songs to the juke box?
PP 8.1 Write a program that reads an arbitrary number of integers that are in the range 0 to 50 inclusive and counts how many occurrences of each are entered. Indicate the end of the input by a value
PP 8.2 Modify the program from PP 8.1 so that it works for numbers in the range between -25 and 25.
PP 8.3 Write a program that creates a histogram that allows you to visually inspect the frequency distribution of a set of values. The program should read in an arbitrary number of integers from a
PP 8.4 The lines in the histogram in PP 8.3 will be too long if a large number of values is entered. Modify the program so that it prints an asterisk for every five values in each category. Ignore
PP 8.5 Write a program that computes and prints the mean and standard deviation of a list of integers x, through x. Assume that there will be no more than 50 input values. Compute both the mean and
PP 8.6 The L&L Bank can handle up to 30 customers who have savings accounts. Design and implement a program that manages the accounts. Keep track of key information and allow each customer to make
PP 8.7 Create a Card class that represents a playing card with a face value and a suit. Then create a class called DeckOf Cards that stores 52 objects of the Card class. Include methods to shuffle
PP 8.8 Write a program that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals. Store the data in an object designed to store a first name (string), last name
PP 8.9 Modify the program you created in PP 8.8 to accomplish the following: Support the storing of additional user information: street address (string), city (string), state (string), and 10-digit
PP 8.10 Use the Question class from Chapter 7 to define a Quiz class. A quiz can be composed of up to 25 questions. Define the add method of the Quiz class to add a question to a quiz. Define the
PP 8.11 Modify your answer to PP 8.10 so that the complexity level of the questions given in the quiz is taken into account. Overload the giveQuiz method so that it accepts two integer parameters
PP 8.12 Define a class called Star that extends Polygon and is shaped like a five-pointed star. Use parameters to the Star constructor to specify the color, position, and scale of the star. Write a
PP 8.13 Define a class called car that extends Group and presents the drawing of a car (side view). Use polygons, polylines, and other shapes to present the car. Write a JavaFX application that
PP 8.14 Modify the QuoteOptions program from Chapter 5 so that it provides three additional quote options. Use arrays to store the category options and quotes, and a choice box to present the options
PP 8.15 Write a JavaFX application that displays an image and plays a sound effect with each mouse click. Rotate through four images and five sound effects, so the image/sound effect pairing is
PP 8.16 Write a JavaFX application that presents 20 circles, each with a random radius and location. If a circle does not overlap any other circle, fill the circle with black. Fill overlapping
PP 8.17 Write a JavaFX application that creates polyline shapes dynamically using mouse clicks. Each mouse click adds a new line segment to the current polyline from the previous
SR 6.1 When a Java program is running, what happens if the expression evaluated for a switch statement does not match any of the case values associated with the statement?
SR 6.2 What happens if a case in a switch statement does not end with a break statement?
SR 6.3 What is the output of the Grade Report program if the user enters 72? What if the user enters 46? What if the user enters 123?
SR 6.4 Transform the following nested if statement into an equivalent switch statement. - if (num1 == 5) myChar 'W': else if (num1 == 6) myChar = 'X'; if (num1 == 7) myChar 'Y'; else myChar 'Z';
SR 6.5 What is the difference between a conditional operator and a conditional statement?
SR 6.6 Write a declaration that initializes a char variable named id to 'A' if the boolean variable first is true and to 'B' otherwise.
SR 6.7 Express the following logic in a succinct manner using the conditional operator.
SR 6.8 Compare and contrast a while loop and a do loop.
SR 6.9 What output is produced by the following code fragment? int low = 0, high = 10; do System.out.println(low); low++; while (low < high);
SR 6.10 What output is produced by the following code fragment? int low = 10, high = 0; do System.out.println(low); low++; while (low
SR 6.11 Write a do loop to obtain a sequence of positive integers from the user, using zero as a sentinel value. The program should output the sum of the numbers.
SR 6.12 When would we use a for loop instead of a while loop?
SR 6.13 What output is produced by the following code fragment? int value = 0; for (int num = 10; num
SR 6.14 What output is produced by the following code fragment? int value = 0; for (int num = 10; num
SR 6.15 What output is produced by the following code fragment? int value = 6; for (int num = 1; num
SR 6.16 Assume die is a Die object (as defined in Section 4.2). Write a code fragment that will roll die 100 times and output the average value rolled.
SR 6.17 What changes would have to be made to the Bullseye program to have a 10-ring target?
SR 6.18 How would you modify the Boxes program so that boxes that are neither narrow or short are filled with white instead of just being outlined in white.
SR 6.19 How would you shift the position of a circle named ring 100 pixels lower than its original position?
SR 6.20 How would you display an Imageview named view at twice its original size?
SR 6.21 What happens if you scale a node by a different factor along the x and y axes?
SR 6.22 How would you rotate an Ellipse named oval 40 degrees clockwise? What if you wanted to rotate it 10 degrees counterclockwise?
EX 6.1 How many iterations will the following for loops execute? a. for (int i = 0; i < 20; i++) { } b. for (int i = 1; i 0; i--) { } e. for (int i = 1; f. for (int i = 1; i = i + 2) { } i < 20; i <
EX 6.2 What output is produced by the following code fragment? for (int num = 0; num
EX 6.3 What output is produced by the following code fragment? for (int val = 200; val >= 0; val if (val 4!= 0) == -= 1) System.out.println(val);
EX 6.4 Transform the following while loop into an equivalent do loop (make sure it produces the same output). int num = 1; while (num < 20) num++; System.out.println(num);
EX 6.5 Transform the while loop from the previous exercise into an equivalent for loop (make sure it produces the same output).
EX 6.6 Write a do loop that verifies that the user enters an even integer value.
EX 6.7 Write a for loop to print the odd numbers from 1 to 99 (inclusive).
EX 6.8 Write a for loop to print the multiples of 3 from 300 down to 3.
EX 6.9 Write a code fragment that reads 10 integer values from the user and prints the highest value entered.
EX 6.10 Write a code fragment that determines and prints the number of times the character 'a' appears in a string object called name.
EX 6.11 Write a code fragment that prints the characters stored in a string object called str backward.
EX 6.12 Write a code fragment that prints every other character in a string object called word starting with the first character.
EX 6.13 Write a method called powersofTwo that prints the first 10 powers of 2 (starting with 2). The method takes no parameters and doesn't return anything.
EX 6.14 Write a method called alarm that prints the string "Alarm!" multiple times on separate lines. The method should accept an integer parameter that specifies how many times the string is
EX 6.15 Write a method called sum100 that returns the sum of the integers from 1 to 100, inclusive.
EX 6.16 Write a method called sumRange that accepts two integer parameters that represent a range. Issue an error message and return zero if the second parameter is less than the first. Otherwise,
EX 6.17 Write a method called countA that accepts a string parameter and returns the number of times the character 'A' is found in the string.
EX 6.18 Write a method called reverse that accepts a string parameter and returns a string that contains the characters of the parameter in reverse order. Note that there is a method in the string
EX 6.19 In the Bullseye program, what is the fill color of the innermost circle before it is changed to red? Explain.
EX 6.20 Given the way the Boxes program is written, what color will a rectangle be if it is both narrow and short? Explain.
EX 6.21 Rewrite the statement used in the Boxes program so that if a box is both narrow and short, its fill color will be orange. Otherwise, keep narrow boxes yellow and short boxes green.
EX 6.22 Write code that will shift a Rectangle named rec 50 pixels right and 10 pixels down, rotate it 45 degrees clockwise, and display it at half its original size.
EX 6.23 Write code that will invert (turn upside down) a ImageView named pic and display it at twice its original size.
EX 6.24 What happens when you apply a transformation to a group?
PP 6.1 Write a program that reads an integer value and prints the sum of all even integers between 2 and the input value, inclusive. Print an error message if the input value is less than 2. Prompt
PP 6.2 Write a program that reads a string from the user and prints it one character per line.
PP 6.3 Write a program that produces a multiplication table, showing the results of multiplying the integers 1 through 12 by themselves.
PP 6.4 Write a program that prints the first few verses of the traveling song "One Hundred Bottles of Beer." Use a loop such that each iteration prints one verse. Read the number of verses to print
Showing 300 - 400
of 978
1
2
3
4
5
6
7
8
9
10