Questions from Starting Out With Java


Q: Write a program that prompts a user for two integers and then

Write a program that prompts a user for two integers and then sums all the values between and including the two integers. Ensure that the second integer entered is larger than the first by continuing...

See Answer

Q: Write a program that prompts the user for an integer. Pass

Write a program that prompts the user for an integer. Pass the integer to a method that determines whether the number is greater than 0; if it is, the method displays the number and passes one less th...

See Answer

Q: Yummy Catering provides meals for parties. In previous chapters, you

Yummy Catering provides meals for parties. In previous chapters, you have created an Event class that holds details for scheduled events, including an event number and number of guests. Now write an a...

See Answer

Q: Write a program that prompts the user for two integers. Pass

Write a program that prompts the user for two integers. Pass them to a recursive method that returns the product of the two integers without using multiplication. In other words, instead of using the...

See Answer

Q: Write a program that creates an array of at least 20 integers

Write a program that creates an array of at least 20 integers and do the following: ❯ Prompt the user for a starting position, and continually reprompt the user for a new value if the starting positio...

See Answer

Q: Figure 12-20 earlier in this chapter shows the output of

Figure 12-20 earlier in this chapter shows the output of a program that displays any number of Os running diagonally from top left to bottom right. Now, write a program that prompts the user for a num...

See Answer

Q: Figure 12-26 shows two typical executions of a program that

Figure 12-26 shows two typical executions of a program that displays a triangle. Create this program by prompting the user for a number of lines to display. The first row of the output contains the nu...

See Answer

Q: Figure 12-27 shows two typical executions of a program that

Figure 12-27 shows two typical executions of a program that displays a large V on the screen after the user enters a height. Write a program that passes the following values to a recursive method that...

See Answer

Q: The Fibonacci sequence is the series of numbers 1, 1,

The Fibonacci sequence is the series of numbers 1, 1, 2, 3, 5, 8, 13, 21, and so on. The last number in the Fibonacci sequence is always the sum of the preceding two numbers. For example, 13 is the su...

See Answer

Q: Assume that the current population of California is 39 million and that

Assume that the current population of California is 39 million and that the population of Texas is 28 million. The population of Texas appears to be growing at a faster rate than that of California. W...

See Answer