Java: An Introduction to Problem Solving and Programming (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
8th Edition
ISBN: 9780134462035
Author: Walter Savitch
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 4, Problem 7PP

Write a program that simulates a bouncing ball by computing its height in foot at each second as time passes on a simulated clock. At time zero, the bail begins at height zero and has an initial velocity supplied by the user (An initial velocity of at least 100 feet per second is a good choice.) After each second, change the height by adding the current velocity; then subtract 32 from the velocity. If the new height is less than zero, multiply both the height and the velocity by −0.5 to simulate the bounce. Step at the fifth bounce. The output from your program should have the following form:

Enter the initial velocity of the ball: 100

Time: 0 Height: 0.0

Time: 1 Height: 100.0

Time: 2 Height: 168.0

Time: 3 Height: 204.0

Time: 4 Height: 208.0

Time: 5 Height: 180.0

Time: 6 Height: 120.0

Time: 7 Height: 28.0

Bounce!

Time: 8 Height: 48.0

. . .

Blurred answer
Students have asked these similar questions
Write a program to calculate the surface area and volume of a square pyramid. A square pyramid has a base that is square and all triangle faces are congruent isosceles triangles. (An isosceles triangle is a triangle in which two of the sides are equal. Length of the base:  a Height of the pyramid:  h Volume = a2h/3 Slant height, s  = sqrt(h2 + (a/2)2)  This is the Pythagorean Theorem part. Area of one pyramid side = s*a/2 Test Case #1 Height(h): 5.0’ Base(a): 2.5’
Write a program to calculate the surface area and volume of a square pyramid. A square pyramid has a base that is square and all triangle faces are congruent isosceles triangles. (An isosceles triangle is a triangle in which two of the sides are equal. Length of the base:  a Height of the pyramid:  h Volume = a2h/3 Slant height, s  = sqrt(h2 + (a/2)2)  This is the  Pythagorean Theorem part. Area of one pyramid side = s*a/2 Here are my calculations:  Test Case #1 Height(h): 5.0’ Base(a): 2.5’   Volume = (2.5**2) * (5/3)   (6.25) * (1.66) = 10.375 cubic feet   Slant Height = math.sqrt(5**2) + (2.5/2)**2)   Sqrt(25+1.5625)   Sqrt(26.5625) = 5.154 feet   Pyramid (not including base) = (5.154) * (2.5/2) * 4   (5.154) * (1.25) * (4) = 25.769 sq. Ft.  I have attached a screenshot of my program I have so far. When I run the program, the output doesn't match what I have for the surface area and volume, am I missing something?
Write a program to calculate the surface area and volume of a square pyramid. A square pyramid has a base that is square and all triangle faces are congruent isosceles triangles. (An isosceles triangle is a triangle in which two of the sides are equal. Length of the base:  a Height of the pyramid:  h Volume = a2h/3 Slant height, s  = sqrt(h2 + (a/2)2)  This is the Pythagorean Theorem part. Area of one pyramid side = s*a/2 For this program you are to determine two things about a square pyramid. 1) the surface area of the four sides. 2) the volume. Do not include surface area of the base.   Test case 1:  Height: 5.0'        Base: 2.5' Test case 2:  Height 2.5          Base: 4.3'   The program asks the user to enter the pyramid height (in feet) and length of the base (in feet). Your program will need to determine surface area, and volume by using pythagorean theorem. Your output should neatly show the height, base, total surface area, and volume of the pyramid using 33 decimal place of…

Chapter 4 Solutions

Java: An Introduction to Problem Solving and Programming (8th Edition)

Ch. 4.1 - Prob. 11STQCh. 4.1 - Write a for statement that displays the even...Ch. 4.1 - Prob. 13STQCh. 4.2 - Write a Java loop that will display the phrase One...Ch. 4.2 - Write a Java loop that will set the variable...Ch. 4.2 - Write a Java loop that will read a list of numbers...Ch. 4.2 - What output is produced by the following code? for...Ch. 4.2 - What output is produced by the following code? for...Ch. 4.2 - What output is produced by the following code? for...Ch. 4.2 - Revise the loop shown in Listing 4.6 to use a...Ch. 4.2 - What is the bug in the code in the section Tracing...Ch. 4.2 - Add some suitable output statements to the...Ch. 4.2 - What is the bug in the code in the previous...Ch. 4.2 - Prob. 24STQCh. 4.2 - Suppose that you did not have assertion checking...Ch. 4.3 - Prob. 26STQCh. 4 - Write a fragment of code that will read words from...Ch. 4 - Develop an algorithm for computing the...Ch. 4 - Develop an algorithm for a simple game of guessing...Ch. 4 - Write a fragment of code that will compute the sum...Ch. 4 - Convert the following code so that it uses nested...Ch. 4 - Write a for statement to compute the sum 1 + 22 +...Ch. 4 - (Optional) Repeat the previous question, but use...Ch. 4 - Write a loop that will count the number of blank...Ch. 4 - Write a loop that will create a new string that is...Ch. 4 - Write a program that will compute statistics for...Ch. 4 - Suppose we attend a party. To be sociable, we will...Ch. 4 - Define an enumeration for each of the months in...Ch. 4 - Write a fragment of code that computes the final...Ch. 4 - Suppose that you work for a beverage company. The...Ch. 4 - Suppose that we want to compute the geometric mean...Ch. 4 - Prob. 16ECh. 4 - Create an applet that draws a pattern of circles...Ch. 4 - Prob. 18ECh. 4 - What does the following fragment of code display?...Ch. 4 - Repeat Practice Program 4 of Chapter 3, but use a...Ch. 4 - Write a program that implements your algorithm...Ch. 4 - Repeat Practice Program 5 of Chapter 3, but use a...Ch. 4 - Write a program to read a list of nonnegative...Ch. 4 - Write a program to read a list of exam scores...Ch. 4 - Combine the programs from Programming Projects 5...Ch. 4 - Write a program that simulates the Magic 8 Ball...Ch. 4 - Whats for dinner? Let the computer decide. Write a...Ch. 4 - Write a program that implements your algorithm...Ch. 4 - Prob. 2PPCh. 4 - Write a program that reads a bank account balance...Ch. 4 - Modify Programming Project 5 from Chapter 2 to...Ch. 4 - Write a program that asks the user to enter the...Ch. 4 - Write a program that simulates a bouncing ball by...Ch. 4 - You have three identical prizes to give away and a...Ch. 4 - Prob. 9PPCh. 4 - Holy digits Batman! The Riddler is planning his...Ch. 4 - Your country is at war and your enemies are using...Ch. 4 - Prob. 12PPCh. 4 - Prob. 13PPCh. 4 - Prob. 14PPCh. 4 - (Challenge) Repeat the previous project, but...Ch. 4 - Write a JavaFx application that displays a series...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY