Question
1) Write a program named TimesTen.java containing a method named timesTen The method should accept a double argument, and r eturn a double value that
1) Write a program named TimesTen.java containing a method named timesTen The method should accept a double argument, and return a double value that is 10 times the value of the argument. Put this method in a program named TimesTen to see if it works.
Inside of main method you will need to declare two variables of type double: double valuePassed = 5.2; double valueReturned; //this will hold the return value from timesTen method You will then print out valueReturned 2) Write a program named Distance.java containing a method named distance The distance a vehicle travels can be calculated as follows: distance = speed * time Write a method named distance that accepts a vehicle's speed and time as arguments, and returns the distance the vehicle has traveled.
In the main method, print out (you decide how it looks): distance speed time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started