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:
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
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Mechanics of Materials (10th Edition)
Concepts Of Programming Languages
Modern Database Management
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- Exercise GradesStatistics (Method): Write a program called GradesStatistics, which reads in n grades (of int between 0 and 100, inclusive) and displays the average, minimum, maximum, median and standard deviation. Display the floating-point values upto 2 decimal places. Your output shall look like:Enter the number of students: 4Enter the grade for student 1: 50Enter the grade for student 2: 51Enter the grade for student 3: 56Enter the grade for student 4: 53{50,51,56,53}The average is: 52.50The median is: 52.00The minimum is: 50The maximum is: 56The standard deviation is: 2.29The formula for calculating standard deviation is:Hints:public class GradesStatistics {public static int[] grades; // Declare an int[], to be allocated later.// This array is accessible by all the methods.public static void main(String[] args) {readGrades(); // Read and save the inputs in int[] gradesprintArray(grades);System.out.println("The average is " + average(grades));System.out.println("The median is " +…arrow_forwardOne type of investment is where you make a single deposit (called the principal) and then let interest add to the balance amount in the account. In this situation, the balance in a savings account may be calculated with this formula: rate balance = principal(1+ ynt n where principal is the amount deposited rate is the yearly interest rate as a decimal (for example 0.045 is 4.5%) n is the number of times interest is compounded per year t is the number of years the money is left in the account As an example, if I deposit $450.00 at 1.2% interest, compounded twice a year, then at the end of 6 years, I should have a balance in the account of $483.49. That means my investment earned me $33.49 over the course of six years (not a good investment). Program specifications: Input: your program should ask the user for the amount of principal, the interest rate as a percent (like 1.2), the number of times interest is compounded per year, and the number of years that the investment will last.…arrow_forwardDistance Traveled ModificationThe distance a vehicle travels can be calculated as follows: Distance = Speed * TimeWrite a method named distance that accepts a vehicle’s speed and time as arguments, and returns the distance the vehicle has traveled.arrow_forward
- basic java please Write a void method named emptyBox()that accepts two parameters: the first parameter should be the height of a box to be drawn, and the second parameter will be the width. The method should then draw an empty box of the correct size. For example, the call emptyBox(8, 5) should produce the following output: ***** * * * * * * * * * * * * ***** The width of the box is 5. The middle lines have 3 spaces in the middle. The height of the box is 8. The middle columns have 6 spacesarrow_forwardCode the following: Language : Java Create a method called triangle that will take in three angles and tell you if you have a triangle Create an overloaded version of the triangle method that only takes in one angle and tells you if it could be a triangle create an overloaded version of the triangle method that only takes in two angles. You must check if it's possible for it to be an isosceles triangle. Don't forget to check both angles : example: angle1*2 + angle2 == 180 or angle1 +angle2*2 == 180arrow_forwardPendulum - Python Eulers methodarrow_forward
- A complex number is a number in the form a+bi, where a and b are real numbers and i is √(-1) The numbers a and b are known as the real part and imaginary part of the complex number, respectively. You can perform addition, subtraction, multiplication, and division for complex numbers using the following formulas: a + bi + c + di = (a+c) + (b+d)i (addition) a + bi − (c + di) = (a−c) + (b−d)i (subtraction) (a + bi) * (c + di) = (ac−bd) + (bc+ad)i (multiplication) (a + bi) / (c + di) = (ac+bd) / (c2+d2) + (bc−ad)i / (c2+d2) (division) You can obtain the Absolute Value for a complex number using the following formula: |a + bi| = √(a2 + b2) A Complex number can be interpreted as a point on a plane by identifying the (a,b) values as the coordinates of the point. The absolute value of the complex number corresponds to the distance of the point to the origin, as shown in the example below. (1) Design a class named Complex for representing complex numbers Include…arrow_forwardJava pleasearrow_forwardThe area of a rectangle can be computed using the following formula: area = width * height; Write a method that returns the area of a rectangle using the following header: public static double getArea(double width, double height) Write a main method that prompts the user to enter the width and height of a rectangle and displays its area. Input example: 1.2 3.4 Output example: The area of the rectangle is 4.08arrow_forward
- Create a method that takes a value and indicate whether it is positive or negative by a return aBoolean value.Declared as: boolean isPositive (float a)arrow_forwardPrime Numbers A prime number is a number that can be evenly divided by only itself and 1. For example, the number 5 is prime because it can be evenly divided by only 1 and 5. The number 6, however, is not prime because it can be evenly divided by 1, 2, 3, and 6. Write a Boolean method named IsPrime that takes an integer as an argument and returns true if the argument is a prime number or false otherwise. Use the method in an application that lets the user enter a number and then displays a message indicating whether the number is prime.arrow_forwardJava Programming The program must use a method The program has 4 racers and the race is 50 units long. This program ends the race if any racer passes the ending point and print who won the race. Each racer moves randomly either: a. range from 3 to 8 units b. 5 sin(5) c. 45/2turn, but at least moves 1 unitarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education