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









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 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
Advertisements
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
task 1 - Java Beginners
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 to the client. Please submit both the client and server programs  Hi Friend
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
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
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
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:the quick brown fox jumps over the lazy dog. word to be searched:the output
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
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 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...? 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
Java programming 1 - Java Beginners
Java programming 1  Hi sir, i facing problem in this program. This program requires passing arrays as parameters and returning arrays from methods.../java/example/java/swing/ Thanks
Java programming 1 - Java Beginners
Java programming 1  thx sir for reply me..but sir can u pls simplify it? cos the answer is not up to my requirement regarding the BMI index...; Hi friend, 1. Ask the user for their height. Convert it to a double
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
EXCEPTIONS-----1 - Java Interview Questions
EXCEPTIONS-----1  How To Handle The Exceptions With Out Using Try,Catch And Throws?I Want Region Plz Post Answer
INTTERFACE 1 - Java Interview Questions
INTTERFACE 1  What is a Interface?  Hi Friend, Interface is the collection of methods with empty implementations and constants variables ( variables with static and final declarations ). All the methods
java bits 1 - Java Interview Questions
java bits 1   Given: 11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12? (Choose three.) A. final B. static C. native D. public E. private F. abstract G
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
More than 1 preparedStatement object - Java Beginners
More than 1 preparedStatement object  Hey but I want to use more than... java... Thanks  Hi Friend, You can use more than one prepared Statement object in the java class.Try the following code: import java.sql.
java and xml problem. plz see this 1 first - XML
java and xml problem. plz see this 1 first  hi, i need to write a java program that generates an xml file as follows: xxx... 002009031100001 22508591226 1
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... version 1 java library in your project. ADS_TO_REPLACE_2 Now you can save
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... and includes  ca.grimoire - alchemy-parent version 1 java library in your project. ADS...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... - orbit-parent version 1 java library in your project. ADS_TO_REPLACE_2 Now you
Maven dependency for com.aspectran - aspectran-parent version 1 is released. Learn to use aspectran-parent version 1 in Maven based Java projects
use this version ( com.aspectran - aspectran-parent version 1 ) in their Java...-parent version 1 in Java projects. Follow the step by step tutorial for using... version 1 java library in your project. ADS_TO_REPLACE_2 Now you can save
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...-parent version 1 java library in your project. ADS_TO_REPLACE_2 Now you can save
Maven dependency for com.cathive - oss-parent version 1 is released. Learn to use oss-parent version 1 in Maven based Java projects
( com.cathive - oss-parent version 1 ) in their Java project if it is based on Maven...? Steps to use  com.cathive - oss-parent version 1 in Java projects. Follow... version 1 java library in your project. ADS_TO_REPLACE_2 Now you can save the file
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...-importer version 1 java library in your project. ADS_TO_REPLACE_2 Now you can...Maven dependency for  com.datathings  - Version 1 of greycat
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... version 14-ea+1 java library in your project. ADS_TO_REPLACE_2 Now you can save
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... and includes  com.servicerocket - servicerocket-oss version 1 java library in your
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... and includes  com.ocpsoft - ocpsoft-parent version 1 java library in your project. ADS...Maven dependency for  com.ocpsoft  - Version 1 of ocpsoft-parent
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... version 16-ea+1 java library in your project. ADS_TO_REPLACE_2 Now you can save
Maven dependency for com.ewise - ewise-parent version 1 is released. Learn to use ewise-parent version 1 in Maven based Java projects
( com.ewise - ewise-parent version 1 ) in their Java project if it is based... in project? Steps to use  com.ewise - ewise-parent version 1 in Java projects...; com.ewise - ewise-parent version 1 java library in your project. ADS
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-media version 18.0.1-ea+1 is released. Learn to use javafx-media version 18.0.1-ea+1 in Maven based Java projects
- javafx-media version 18.0.1-ea+1 in Java projects. Follow the step by step...-media version 18.0.1-ea+1 java library in your project. ADS_TO_REPLACE_2 Now you...Maven dependency for  org.openjfx  - Version 18.0.1-ea+1 of javafx
Maven dependency for org.openjfx - javafx-fxml version 18.0.1-ea+1 is released. Learn to use javafx-fxml version 18.0.1-ea+1 in Maven based Java projects
use this version ( org.openjfx - javafx-fxml version 18.0.1-ea+1 ) in their Java...-fxml version 18.0.1-ea+1 in Java projects. Follow the step by step tutorial... version 18.0.1-ea+1 java library in your project. ADS_TO_REPLACE_2 Now you can save
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... and includes  ch.cmbntr - cmbntr-oss-parent version 1 java library in your project...Maven dependency for  ch.cmbntr  - Version 1 of cmbntr-oss-parent
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...; at.molindo - molindo-oss-pom version 1 java library in your project. ADS...Maven dependency for  at.molindo  - Version 1 of molindo-oss-pom
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... and includes  at.ipsquare - ipsquare-commons-parent version 1 java library in your
Maven dependency for com.cloudbees - cloudbees-oss-parent version 1 is released. Learn to use cloudbees-oss-parent version 1 in Maven based Java projects
; com.cloudbees - cloudbees-oss-parent version 1 in Java projects. Follow the step...; com.cloudbees - cloudbees-oss-parent version 1 java library in your project...Maven dependency for  com.cloudbees  - Version 1 of cloudbees-oss
Maven dependency for com.collaborne - collaborne-oss-parent version 1 is released. Learn to use collaborne-oss-parent version 1 in Maven based Java projects
version 1 ) in their Java project if it is based on Maven and Gradle. How... to use  com.collaborne - collaborne-oss-parent version 1 in Java projects. Follow... and includes  com.collaborne - collaborne-oss-parent version 1 java library
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...-media version 17.0.2-ea+1 java library in your project. ADS_TO_REPLACE_2 Now you...Maven dependency for  org.openjfx  - Version 17.0.2-ea+1 of javafx
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... and includes  org.openjfx - javafx-fxml version 16-ea+1 java library
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... and includes  org.openjfx - javafx-fxml version 15-ea+1 java library
Maven dependency for org.openjfx - javafx-media version 20-ea+1 is released. Learn to use javafx-media version 20-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 20-ea+1 ) in their Java... version 20-ea+1 in Java projects. Follow the step by step tutorial for using... that downloads and includes  org.openjfx - javafx-media version 20-ea+1 java
Maven dependency for org.openjfx - javafx-fxml version 20-ea+1 is released. Learn to use javafx-fxml version 20-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-fxml version 20-ea+1 ) in their Java project... 20-ea+1 in Java projects. Follow the step by step tutorial for using the latest... and includes  org.openjfx - javafx-fxml version 20-ea+1 java library
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... and includes  org.openjfx - javafx-fxml version 18-ea+1 java library

Ads