Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
4th Edition
ISBN: 9780134787961
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 5, Problem 12PC

Kinetic Energy

In physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving object’s kinetic energy:

  K E = 1 2 m v 2

The variables in the formula are as follows: KE is the kinetic energy, m is the object’s mass in kilograms, and v is the object’s velocity, in meters per second.

Write a method named kineticEnergy that accepts an object’s mass (in kilograms) and velocity (in meters per second) as arguments. The method should return the amount of kinetic energy that the object has. Demonstrate the method by calling it in a program that asks the user to enter values for mass and velocity.

Blurred answer
Students have asked these similar questions
Herbert’s Home Repair estimates each job cost as the cost of materials plus $35 per hour while on the job, plus $12 per hour for travel time to the job site. The main() method prompts the user for the name of a job (for example, Smith bathroom remodel), the cost of materials, the number of hours of work required, and the number of hours travel time. Pass the numeric data to a method that computes an estimate for the job and returns the computed value to the main() method which displays the job name and estimated price.   here is my code: it is showing 2 errors (in the snapshot shown below) please help   import java.util.Scanner; class JobPricing {     public static void main(String[] args) {         String description;         double materials;         double hoursOnJob;         double hoursTraveling;         double price;         Scanner input = new Scanner(System.in);         System.out.print("Enter job description >> ");         description = input.nextLine();…
Herbert’s Home Repair estimates each job cost as the cost of materials plus $35 per hour while on the job, plus $12 per hour for travel time to the job site. The main() method prompts the user for the name of a job (for example, Smith bathroom remodel), the cost of materials, the number of hours of work required, and the number of hours travel time. Pass the numeric data to a method that computes an estimate for the job and returns the computed value to the main() method which displays the job name and estimated price. An example of the program is shown below: Enter job descriptpon >> Room 210 Kitchen Enter cost of materials >> 5,000 Enter hours on the job work >> 120 Enter hours traveling >> 0 The price for Room 210 Kitchen is $9200. import java.util.Scanner; class JobPricing {     public static void main(String[] args) {         String description;         double materials;         double hoursOnJob;         double hoursTraveling;         double price;…
When an object is falling because of gravity, the following formula can be used to determine the distance the object falls in a specific time period:  d = ½ gt2 The variables in the formula are as follows: d is the distance in meters, g is 9.8, and t is the amount of time, in seconds, that the object has been falling. 5.3.1. Create a method: FallingDistance Parameters: t, object’s falling time (in seconds) t may or may not be an integer value! Return value: the distance, in meters, that the object has fallen during that time interval Calculations: Use Math.Pow() to calculated the square in the formula 5.3.2. Demonstrate the method by calling it from a loop that passes the values 1 through 20 as arguments, and displays each returned value. Sample output lines: . . . t =  5, d = 122.5 . . . t = 10, d = 490 . . . Your output should have lines for t=1, t=2, t=3, . . . t=20.

Chapter 5 Solutions

Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)

Ch. 5.4 - Prob. 5.11CPCh. 5.4 - Prob. 5.12CPCh. 5.4 - Prob. 5.13CPCh. 5.4 - Prob. 5.14CPCh. 5 - Prob. 1MCCh. 5 - Prob. 2MCCh. 5 - Prob. 3MCCh. 5 - Prob. 4MCCh. 5 - A value that is passed into a method when it is...Ch. 5 - Prob. 6MCCh. 5 - Prob. 7MCCh. 5 - Prob. 8MCCh. 5 - Prob. 9MCCh. 5 - True or False: You terminate a method header with...Ch. 5 - Prob. 11TFCh. 5 - Prob. 12TFCh. 5 - Prob. 13TFCh. 5 - Prob. 14TFCh. 5 - Prob. 15TFCh. 5 - Prob. 16TFCh. 5 - Prob. 17TFCh. 5 - True or False: No two methods in the same program...Ch. 5 - True or False: It is possible for one method to...Ch. 5 - True or False: You must have a return statement in...Ch. 5 - Prob. 1FTECh. 5 - Look at the following method header: public static...Ch. 5 - Prob. 3FTECh. 5 - Prob. 4FTECh. 5 - Prob. 1AWCh. 5 - Here is the code for the displayValue method,...Ch. 5 - Prob. 3AWCh. 5 - What will the following program display? public...Ch. 5 - A program contains the following method...Ch. 5 - Prob. 6AWCh. 5 - Prob. 7AWCh. 5 - Write a method named square that accepts an...Ch. 5 - Write a method named getName that prompts the user...Ch. 5 - Write a method named quartersToDol1ars. The method...Ch. 5 - Prob. 1SACh. 5 - Prob. 2SACh. 5 - What is the difference between an argument and a...Ch. 5 - Where do you declare a parameter variable?Ch. 5 - Prob. 5SACh. 5 - Prob. 6SACh. 5 - Prob. 1PCCh. 5 - Retail Price Calculator Write a program that asks...Ch. 5 - Rectangle AreaComplete the Program If you have...Ch. 5 - Paint Job Estimator A painting company has...Ch. 5 - Prob. 5PCCh. 5 - Celsius Temperature Table The formula for...Ch. 5 - Test Average and Grade Write a program that asks...Ch. 5 - Conversion Program Write a program that asks the...Ch. 5 - Distance TraveLed Modification The distance a...Ch. 5 - Stock Profit The profit from the sale of a stock...Ch. 5 - Multiple Stock Sales Use the method that you wrote...Ch. 5 - Kinetic Energy In physics, an object that is in...Ch. 5 - isPrime Method A prime number is a number that is...Ch. 5 - Prime Number List Use the isPrime method that you...Ch. 5 - Even/Odd Counter You can use the following logic...Ch. 5 - Present Value Suppose you want to deposit a...Ch. 5 - Rock, Paper, Scissors Game Write a program that...Ch. 5 - ESP Game Write a program that tests your ESP...
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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
CPP Function Parameters | Returning Values from Functions | C++ Video Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=WqukJuBnLQU;License: Standard YouTube License, CC-BY