# java code 8 of 1

arvind
java code 8 of 1
1 Answer(s)      6 years and 5 months ago
Posted in : JavaScript Questions

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
8 - Java Beginners
8  Unit board is PIC18F4520 Purpose of euiqpment is to make test heart beat; fast/slow/moderate heartbeat I need to activate the speaker when testing for heartbeat. Should be able to start buzzing when testing is done. Should
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
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
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
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
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
task 1  Please write a Java client that send a small letters string to a Java server which convert it to uppercase letters and send it back..., Try the following code: import java.util.*; class ChangeCase{ public
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
problem 1 - Java Beginners
problem 1   Hi, please help me!!!! How can i code in java using Two-dimensional Arrays? This question is related to the one i posted before. this is my input data file: 88 90 94 102 111 122 134 75 77 80 86 94 103 113 80
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
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 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
que 1 - Java Beginners
que 1  WAP to enter a sentence & count the no. of times a particular word occurs in it.Display the frequency of the searched word. eg- input...:frequency of word-2 times   Hi Friend, Try the following code: import
java bits 8 - Java Interview Questions
java bits 8  Assume that country is set for each class. Given: 10. public class Money { 11. private String country, name; 12. public getCountry() { return country; } 13.} and: 24. class Yen extends Money { 25. public
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
array 1 - Java Beginners
array 1  WAP to input values in 2 arrays and merge them to array M.  Hi Friend, Try the following code: import java.util.*; class MergeArray{ public static int[] merge(int [] ... arr) { int arrSize = 0
function 1 - Java Beginners
function 1  WAP to calculate the value of x,where x=tan(A)+tan(B)/1+tan(A)*tab(B)  Give more details like how to calculate and what is tan(A) and tan(B),etc
Java programming 1 - Java Beginners
Java programming 1  write one program, which consists of a main...? There are nine words in total Java has a standard to index elements starting... be at position 1, etc ?A sentence is constructed with a series of words? Index 0 1 2 3 4
Java programming 1 - Java Beginners
Java programming 1  write one program, which consists of a main... 1 2 3 4 5 6 7 8 We need to provide a method...? There are nine words in total Java has a standard to index elements starting
Java programming 1 - Java Beginners
Java programming 1  Thx sir for reply me ^^ err how bout if using scanner class or further method to solve that code? instead of using array?  ...://www.roseindia.net/java/java-tips/examples-introductory/console/console-input
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: 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 programming 1 - Java Beginners
Java programming 1  hi there, Sir! Can u help me check where my program gone wrong? here are my coding =D, hope to get reply from u guys soon... = JOptionPane.showInputDialog(null,"Enter mark 1", "Homework 8",JOptionPane.QUESTION_MESSAGE
Java programming 1 - Java Beginners
Java programming 1  Hi sir, i facing problem in this program....   Hi friend, Please send me full code. Because your.../java/example/java/swing/ Thanks
Java programming 1 - Java Beginners
Java programming 1  thx sir for reply me..but sir can u pls simplify...; Hi friend, 1. Ask the user for their height. Convert it to a double... is the code. import javax.swing.JFrame; class BMI { public static void
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
Tutorials