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 and a height of 1/2 * v * t where v is the speed at t.

View Answers

December 22, 2010 at 1:11 PM

Hi Friend,

Try the following code:

import java.util.*;
import java.text.*;
class CalculateHeight{
public static void main(String[] args){
DecimalFormat df = new DecimalFormat("##.00");
Scanner input=new Scanner(System.in);
System.out.print("Enter constant rate:");
double g=input.nextDouble();
System.out.print("Enter time:");
double t=input.nextDouble();
double speed=g*t;
double h=speed*t;
double height=h/2;
System.out.println("Rocket reaches at the height of: "+df.format(height)); 
}
}

Thanks

Ads









Related Tutorials/Questions & Answers:
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 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
Advertisements
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 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
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, Try
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
Prime numbers in Java between 1 and 100
Prime numbers in Java between 1 and 100  Hi, How to display prime numbers in java between 1 and 100? Thanks   Hi, Prime numbers are the number which is divisible by itself and 1. I have provide you Java program
JAVA leftshift operator add 1 instead of 0
JAVA leftshift operator add 1 instead of 0  Hi Guys, I have a task... So, the answer will be 20. But, I want to have "1" instead of "0"s. So... this in java. Please help me asap. Thanks. Code Eater
Maven dependency for com.datathings - greycat version 1 is released. Learn to use greycat version 1 in Maven based Java projects
( com.datathings - greycat version 1 ) in their Java project if it is based on Maven...? Steps to use  com.datathings - greycat version 1 in Java projects. Follow... that downloads and includes  com.datathings - greycat version 1 java
Maven dependency for org.openjfx - javafx version 16-ea+1 is released. Learn to use javafx version 16-ea+1 in Maven based Java projects
( org.openjfx - javafx version 16-ea+1 ) in their Java project if it is based...? Steps to use  org.openjfx - javafx version 16-ea+1 in Java projects... code that downloads and includes  org.openjfx - javafx version 16-ea+1 java
Maven dependency for com.ocpsoft - ocpsoft-parent version 1 is released. Learn to use ocpsoft-parent version 1 in Maven based Java projects
this version ( com.ocpsoft - ocpsoft-parent version 1 ) in their Java project... - ocpsoft-parent version 1 java library in your project. Now you can save...Maven dependency for  com.ocpsoft  - Version 1 of ocpsoft-parent
Maven dependency for com.servicerocket - servicerocket-oss version 1 is released. Learn to use servicerocket-oss version 1 in Maven based Java projects
1 ) in their Java project if it is based on Maven and Gradle. How to use ...; com.servicerocket - servicerocket-oss version 1 in Java projects. Follow...; com.servicerocket - servicerocket-oss version 1 java library in your project. Now
Maven dependency for org.openjfx - javafx version 14-ea+1 is released. Learn to use javafx version 14-ea+1 in Maven based Java projects
( org.openjfx - javafx version 14-ea+1 ) in their Java project if it is based...? Steps to use  org.openjfx - javafx version 14-ea+1 in Java projects... code that downloads and includes  org.openjfx - javafx version 14-ea+1 java
Maven dependency for com.datathings - greycat-importer version 1 is released. Learn to use greycat-importer version 1 in Maven based Java projects
- greycat-importer version 1 in Java projects. Follow the step by step tutorial...Maven dependency for  com.datathings  - Version 1 of greycat..., the released version of  com.datathings - greycat-importer library is 1. Developer
Maven dependency for be.hikage - hikage-parent version 1 is released. Learn to use hikage-parent version 1 in Maven based Java projects
( be.hikage - hikage-parent version 1 ) in their Java project if it is based...? Steps to use  be.hikage - hikage-parent version 1 in Java projects... code that downloads and includes  be.hikage - hikage-parent version 1 java
Maven dependency for ca.grimoire - alchemy-parent version 1 is released. Learn to use alchemy-parent version 1 in Maven based Java projects
this version ( ca.grimoire - alchemy-parent version 1 ) in their Java project... - alchemy-parent version 1 java library in your project. Now you can save...Maven dependency for  ca.grimoire  - Version 1 of alchemy-parent
Maven dependency for cloud.orbit - orbit-parent version 1 is released. Learn to use orbit-parent version 1 in Maven based Java projects
( cloud.orbit - orbit-parent version 1 ) in their Java project if it is based... in project? Steps to use  cloud.orbit - orbit-parent version 1 in Java projects... version 1 java library in your project. Now you can save the file in Eclipse
Maven dependency for cloud.orbit - orbit-java-parent version 1 is released. Learn to use orbit-java-parent version 1 in Maven based Java projects
Maven dependency for  cloud.orbit  - Version 1 of orbit-java-parent... version of  cloud.orbit - orbit-java-parent library is 1. Developer can use this version ( cloud.orbit - orbit-java-parent version 1 ) in their Java
Maven dependency for org.openjfx - javafx-fxml version 16-ea+1 is released. Learn to use javafx-fxml version 16-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-fxml version 16-ea+1 ) in their Java project... 16-ea+1 in Java projects. Follow the step by step tutorial for using the latest...; org.openjfx - javafx-fxml version 16-ea+1 java library in your project
Maven dependency for at.ipsquare - ipsquare-commons-parent version 1 is released. Learn to use ipsquare-commons-parent version 1 in Maven based Java projects
1 ) in their Java project if it is based on Maven and Gradle. How to use ...; at.ipsquare - ipsquare-commons-parent version 1 in Java projects. Follow... - ipsquare-commons-parent version 1 java library in your project. Now you
Maven dependency for at.molindo - molindo-oss-pom version 1 is released. Learn to use molindo-oss-pom version 1 in Maven based Java projects
this version ( at.molindo - molindo-oss-pom version 1 ) in their Java project... - molindo-oss-pom version 1 java library in your project. Now you can save...Maven dependency for  at.molindo  - Version 1 of molindo-oss-pom
Maven dependency for org.openjfx - javafx-media version 18-ea+1 is released. Learn to use javafx-media version 18-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 18-ea+1 ) in their Java... version 18-ea+1 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 18-ea+1 java library in your
Maven dependency for org.openjfx - javafx-fxml version 18-ea+1 is released. Learn to use javafx-fxml version 18-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-fxml version 18-ea+1 ) in their Java project... 18-ea+1 in Java projects. Follow the step by step tutorial for using the latest...; org.openjfx - javafx-fxml version 18-ea+1 java library in your project
Maven dependency for org.openjfx - javafx-media version 15-ea+1 is released. Learn to use javafx-media version 15-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 15-ea+1 ) in their Java... version 15-ea+1 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 15-ea+1 java library in your
Maven dependency for org.openjfx - javafx-media version 16-ea+1 is released. Learn to use javafx-media version 16-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 16-ea+1 ) in their Java... version 16-ea+1 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 16-ea+1 java library in your
Maven dependency for org.openjfx - javafx-fxml version 15-ea+1 is released. Learn to use javafx-fxml version 15-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-fxml version 15-ea+1 ) in their Java project... 15-ea+1 in Java projects. Follow the step by step tutorial for using the latest...; org.openjfx - javafx-fxml version 15-ea+1 java library in your project
Maven dependency for org.openjfx - javafx-media version 17.0.2-ea+1 is released. Learn to use javafx-media version 17.0.2-ea+1 in Maven based Java projects
- javafx-media version 17.0.2-ea+1 in Java projects. Follow the step by step... 17.0.2-ea+1 java library in your project. Now you can save the file in Eclipse...Maven dependency for  org.openjfx  - Version 17.0.2-ea+1 of javafx
Maven dependency for org.openjfx - javafx-fxml version 17.0.2-ea+1 is released. Learn to use javafx-fxml version 17.0.2-ea+1 in Maven based Java projects
use this version ( org.openjfx - javafx-fxml version 17.0.2-ea+1 ) in their Java...-fxml version 17.0.2-ea+1 in Java projects. Follow the step by step tutorial...Maven dependency for  org.openjfx  - Version 17.0.2-ea+1 of javafx
Maven dependency for ch.cmbntr - cmbntr-oss-parent version 1 is released. Learn to use cmbntr-oss-parent version 1 in Maven based Java projects
this version ( ch.cmbntr - cmbntr-oss-parent version 1 ) in their Java project...; ch.cmbntr - cmbntr-oss-parent version 1 java library in your project. Now you can...Maven dependency for  ch.cmbntr  - Version 1 of cmbntr-oss-parent
why java ignore backspace event when there are more then 1 keychar for a single keystroke.
why java ignore backspace event when there are more then 1 keychar for a single keystroke.  why java ignore backspace event when there are more then 1 keychar for a single keystroke. Assume that i have a text field to get
contructors 1&test
contructors 1&test   how do i Create a class named Box that includes... the 'XXX' with the value of length using the Java keyword this in your code. ??h... to replace the 'XXX' with the values of length and width using the Java keyword

Ads