# java code 8 of 1

Develop a program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time, and the Pythagorean Theorem is c2 = a2 + b2.

December 22, 2010 at 3:15 PM

Hi Friend,

Try the following code:

```import java.util.*;
import java.text.*;

class DistanceTravelledbyBoat{

public static void main(String[] args){
DecimalFormat df = new DecimalFormat("##.00");
Scanner input=new Scanner(System.in);
System.out.print("Enter width of river: ");
double width=input.nextDouble();
System.out.print("Enter boat's speed perpendicular to river: ");
double boatspeed=input.nextDouble();
System.out.print("Enter river's speed: ");
double riverspeed=input.nextDouble();
double a=width;
double bs=boatspeed;
double c=0;
double t=a/bs;
double rs=riverspeed;
double b=t*rs;
double distance=c*c;
double BB=b*b;
double AA=a*a;
distance=AA+BB;
System.out.println("Distance boat travels: "+df.format(distance));
}
}
```

Thanks

java code 8 of 1
java code 8 of 1  Develop a program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time
java code 1 of 2
java code 1 of 2  Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes   Hi Friend, Visit
java code 1 of 2
java code 1 of 2  Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts... the following code: import java.util.*; class WashingMachine { Scanner input
Filter collection in Java 8
Java in it. How to filter this using the Java 8? Thanks   Hi, Example of Filter collection in Java 8 You can use the following code in Java 8...Filter collection in Java 8  Hi, I have following collection
java program 8
java program 8  Develop the program calculateHeight, which computes the height that a rocket reaches in a given amount of time. If the rocket accelerates at a constant rate g, it reaches a speed of g ? t in t time units
Lambda Expression in Java 8
Lambda Expression in Java 8: Learn the power of Lambda Expression... in the Java 8. This is the biggest upgrade introduced in the Java so far... Expression in Java 8? The Lambda Expression is one of most important feature added
Java 8 consumer class(interface) example
How to use the Java 8 consumer class(interface)? In this example program I will show you how you can use the consumer interface of the Java 8 to iterate.... The Consumer is a functional interface added to the Java 8 which is used to assign
Building and Running Java 8 Support
Building and Running Java 8 Support  As you know Java 8 is already released and available for download. Now I am developer of Java based projects. So... and run Java 8 application in Eclipse? Thanks   Hi, don't worry
java code7 of 1
java code7 of 1  Develop the program calculateHeight, which computes the height that a rocket reaches in a given amount of time. If the rocket accelerates at a constant rate g, it reaches a speed of g Ã?Â· t in t time units
java program 1
java program 1  (4) WAP to take input of a String and check wheather it is valid number or not? Sample Output1: Enter a String : 10 10 is a number Sample Output2: Enter a String : 10b1 10b1 is not a number (5) WAP to take
JEE 8 - Java Enterprise Edition 8
JEE 8 - Java Enterprise Edition 8 Tutorials, Examples and latest updates... about the JEE 8: The Java Community Process (JCP) team has started the development of next generation JEE 8 Java EE 8 Takes Off
Installing oracle Java 8 on Ubuntu 18.04
: Step 1: add java 8 repository with following command: sudo add-apt-repository ppa...Installing oracle Java 8 on Ubuntu 18.04  Hi, What are the steps for installing oracle java 8 on ubuntu 18.04? I want to install Oracle Java 8
Learn the Java 8 and master the new features of JDK 8
JDK 8 - Java 8 Tutorial and examples: Learn JDK 8 with the help of examples... bug fixes. Here we are giving the news, articles and updates of Java 8. About Java 8 Java 8 Officially released JDK 8 Developers
How to download and install Java 8 on Windows?  I am beginner in Java going to learn and make program in Java. Is there any tutorial for setting up Java development kit? Tell me How to download and install Java 8 on Windows
of upcoming Java 8. Lambda expressions will allow code to be streamlined. When...Java 8 is slated to be released in March 2014 but the debate has already begun... for Java developers or not. This debate has made Java 8 update as the most
Java EE 8 Takes Off
Finally its good news for Java developers as Java EE 8 Takes Off The future version of Java EE 8 officially launched as JSR 366 via the JCP (Java Community... to be introduced in the JEE8. The primary focus of Java EE 8 will be providing
Java 8: Java 8 is officially released and it can be downloaded
Java 8 officially released Java 8 is finally available for download - Download the latest Java 8 SDK and start developing next generation applications for your client. Java 8 comes with many new features including Lambda expression
Java EE 8 Takes Off
Java EE 8 the next generation application development platform is starting... of next generation enterprise application development platform Java EE 8. JCP team is no featuring out the features to be added to the Java EE 8
Java 8 Consumer Interface with forEach Loop
How to use the Java 8 Consumer Interface with forEach Loop? In this tutorial I will explain you about the Java 8 Consumer Interface and then explain you how... you can use the Java 8 Consumer Interface and then iterate through the class
JAVA code For
JAVA code For   JAVA code For "Traffic signals Identification for vehicles
loop code to print the Pyramid: 1 1234 12 123 123 12 1234 1
loop code to print the Pyramid: 1 1234 12 123 123 12 1234 1  Hi, I want to know how the code to print the pyramid below works. It uses nested for loops. Pyramid: 1 1234 12 123 123 12 1234 1
java programming code
java programming code  strong textHi I need the java code...:" Apt 23" ADDRESS-2:" Building 8" ADDRESS-3: ""Winchester" POST CODE: "89763" ENTER CODE (XX to Stop): CODE: "D24" QUANTITY: "2" CODE:" K16" QUANTITY: "1" CODE:XX
WAP in java to print the series 1*2*3
WAP in java to print the series 1*2*3  WAP in java to print the series 123
code in java
code in java  In NASA, two researchers, Mathew and John, started...: T(n) = n(n+1)/2 These numbers are called Mathew numbers. And scientist John... this perpetually, the numbers will end in 1 or 4. If a positive integer ends
Java code
Java code  Create a Bank class with methods deposit & withdraw....   Hi Friend, Try the following code: import javax.swing.*; class..."); return 1; } bal = bal + amt; return
how to read text file with java 8 stream api
code. how to read text file with java 8 stream api? Thanks   Hi...how to read text file with java 8 stream api  Hi, I want to use Java... in Java 8. package my.code; import java.io.IOException; import
JAVA CODE
JAVA CODE  JAVA SOURCE CODE TO BLOCK A PARTICULAR WEB SITES(SOCIAL WEB SITE
java code
java code  write a java code to convert hindi to english using arrays
java code
java code  java database code to retrieve data at runtime and please give codes for insert delete too.... using jsp and withot jsp   1... border="1"> <tr><th>Name</th><th>Address</th><
Read file line by line in Java 8
Java 8 Read file - Reading file line by line in Java 8 Today  we will discuss the new API which is added to Java 8 for reading a file line by line... feature of Java 8. In Java 8 the class java.nio.file.Files was modified and new