Hi, PFB the code.
I am assuming that input is being provided via STDIN. Also I have attached the sample output screenshot. Please get back to me in case of any doubt and upvote if it was helpful.
import java.io.Console;
import java.util.Scanner;
public class HelloWorld{
public static void main(String []args){
Scanner input = new Scanner(System.in);
System.out.println("Please enter the distance travelled(in
miles)");
double distance = input.nextDouble();
System.out.println("You entered "+ distance +" miles");
System.out.println("Please enter the time taken travelled(in hours,
minutes & seconds respectively)");
distance = distance*1.6;
double hours = input.nextDouble();
double minutes = input.nextDouble();
double seconds = input.nextDouble();
System.out.println("You entered "+ hours +"hours "+ minutes+ "
minutes"+ seconds+" seconds.");
double time_in_hours = hours + (minutes)/60.0 +
(seconds)/3600.0;
double average_speed = distance/time_in_hours;
System.out.println("The average speed is "+ average_speed);
}
}
Need this done is java program coding in the simplest way possible. (Average speed in kilometers)...
Write a program that displays the following pattern: Write a program that displays the following table: Assume a runner runs 14 kilometers in 45 minutes and 30 seconds. Write a program that displays the average speed in miles per hour. (Note that 1 mile is 1.6 kilometers) The U.S. Census Bureau projects population based on the following assumptions: One birth every 7 seconds One death every 13 seconds One new immigrant every 45 seconds Write a program to display the...
A car travels 40 miles in 30 minutes. a. What is the average velocity in kilometers/hour? b. If the car weighs 1.5 tons, what is its kinetic energy in joules (Note: you will need to convert your velocity to m/s)? c. When the driver applies the brake, it takes 15 seconds to stop. How far does the car travel (in meters) while stopping? d. What is the average acceleration of the car (in m/s2) during braking?
1 of 2) Calculate the speed, C, (in meters per second) of a tsunami with a wavelength of 180,000 meters (180 kilometers or112 miles) and period of 15 minutes traveling over the Pacific (which has an average depth of 4000 meters (4 kilometers or 2.5 miles). Round up your answer so that there is no decimal. Note that the answer is not 200 m/s as it is incorrect 2 of 2) Using the speed of the tsunami that you calculated...
Need help coding with Java. Explanation in code would be
greatly appreciated. Thanks
Bar graph 2.0 Write a program that accepts a list of up to 100 integers and displays a bar graph showing the frequencies of the values and the corresponding percentage frequency distributions (printed to 1 significant digit). Example runs are shown below. Number of values to graph: Enter the integer values separated by a space: Bar graph for 3 #1111# 01110 100.01 umber of integers to readi...
Java (Please answer in a specific way and not just show the program) Determine the largest values of n for which the corresponding Fibonacci Numbers can be computed within the given time. n = _____ time required: less than 10 seconds n = _____ time required: less than 30 seconds n = _____ time required: less than 1 minute n = _____ time required: less than 5 minutes Estimate the value of n for the largest value of fib(n) that...
I had help with a program, it requires constants and 3 functions. Ask the user for the number of miles on the route, the average speed and the time of day Randomly generate an increase in the route time based upon whether it’s rush hour or not Calculate the minutes in the route based upon miles, average speed and random traffic increase Print out the miles, minutes and a message The program will continue asking the user for another trip’s...
Need some assistance of
reorganizing this whole program. I have the right code for
everything I just need help on putting all the codes in the right
spot so it can come out to the correct output.
output is supposed to look like this:
1 \\ user inputs choice to convert 12 to 24
8 \\ user inputs 8 for hours
30 \\ user inputs 30 for minutes
20 \\ user inputs 20 for seconds
AM \\ user inputs AM...
WRITE THIS PROGRAM IN JAVA CODING ONLY ! Program 1: In Order Using an IF/ELSE IF/ELSE structure, write a program that will prompt the user for three numbers and displays them in ascending order. First, the program will prompt the user for each of the three numbers. Next, find the smallest value of the three. Then decide which of the other two is the next smallest. Then have the program display the three numbers in ascending order. Be sure to...
Java Programming. Please make sure program compiles, the code is
copyable, and screenshots of the output are provided for 5 stars
:-) Calculation for speed is just supposed to be google
searched
1) 18 points] You've been hired by Pedal Punchers to write a Java console application that estimates bicycle speed in miles per hour. Use a validation loop to prompt for and get from the user the wheel diameter of a bicycle in inches in the range 10-50. Then...
Java Programming
The program template represents a complete working Java program
with one or more key lines of code replaced with comments. Read the
problem description and examine the output, then study the template
code. Using the problem-solving tips as a guide, replace the /* */
comments with Java code. Compile and execute the program. Compare
your output with the sample output provided. Modify class Time2 to
include a tick method that increments the time stored in a Time2
object...