Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


arvind
java code7 of 1
1 Answer(s)      3 years and 8 months ago
Posted in : JavaScript Questions


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.


Advertisement
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 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
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
Java Programming: Chapter 1
Chapter 1 Overview: The Mental Landscape WHEN YOU BEGIN a journey... is and how one is created. Since you will be writing programs in the Java... in particular and about the modern, networked computing environment for which Java
Java: Regex Exercises 1
Java: Regex Exercises 1 Name _______________________________ Assume String subject = "This is test 123 of <a href="http://here.there.tld">Hello</>"; String regex; String result; . . . Pattern pat = Pattern.compile(regex
Java: Method Exercises 1
Java NotesMethod Exercises 1 Name: _________________________________ What...? ___________________________ ___________________________ ___________________________ ___________________________ ___________________________ ___________________________ 1... { result = 1; } return result; } } Copyleft 2005
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 Programming: Chapter 1 Quiz
Quiz Questions For Chapter 1 THIS PAGE CONTAINS A SAMPLE quiz on material from Chapter 1 of this on-line Java textbook. You should be able... the quiz questions can be found here. Question 1: One of the components
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
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 Programming: Chapter 1 Quiz Answers
Sample Quiz Answers For Chapter 1 THIS PAGE CONTAINS SAMPLE ANSWERS to the Quiz on Chapter 1 of this on-line Java textbook. Note... 1: One of the components of a computer is its CPU. What is a CPU and what
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
Java arraycopy example- 1
of java. Code: class DisplyaArrayCopy ...;intArray = new int[] { 1, 2, 3, 4, 5 
really need help on how to write this program plz some 1 help out. - Java Beginners
really need help on how to write this program plz some 1 help out.  i am confused here on what to write can some 1 help out here i dont quite understand how to code it so can some 1 help out. Part II Write, compile and execute
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
i am confused here on what to write can some 1 help out here - Java Beginners
i am confused here on what to write can some 1 help out here  i don't quite understand how to code it so can some one help out
arraylist not able to store large amount of data( over 1 lakh records) - Java Interview Questions
arraylist not able to store large amount of data( over 1 lakh records)  A result set containing over 1 lakhs of records is used to set data to an object and in turn that object is added to an arraylist one by one iterating over
Java Interview Questions - Page 1
Java Interview Questions - Page 1       Java Interview Questions by Inigo Nirmal...: Why Java does not support multiple inheritence ?  Answer: Java
String Exercises 1 - Answers
Java: String Exercises 1 - Answers Answers to the String Exercises 1. 3 -- s refers to exactly the same string as a. ERROR -- t is a local variable, and it must be assigned a value first. "1abc" -- + means concatenation
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
Tags in struts 1
Tags in struts 1   I have problem in Include tag in Struts this tag using but it is not work Please Explain
Hibernate 1 - Hibernate
Hibernate 1  what is a fetchi loading in hibernate?i want source code?plz reply
Logging Tutorial - Part 1
Logging Tutorial - Part 1 2000-12-14 The Java Specialists' Newsletter [Issue 003] - Logging part 1 Author: Dr. Heinz M. Kabutz If you are reading... to the third "The Java(tm) Specialists' Newsletter", a low-volume newsletter
Ajax Question 1
Ajax Question 1  I am having 3 fields in jsp they are Fieldname,Fieldtype,Required. If i enter Fieldname as studentid,Fieldtype as checkbox,Required as true(i.e., mandatory field as *).It should store their details in database
WEBSERVICES=1 - WebSevices
WEBSERVICES=1  I have develop webservices through wsad classes i dont want like this.I want like Create simple class to acess webservice is it possibule to create simple class to acess the webservice?  Hi Friend
data insertion and fetch 1
data insertion and fetch 1  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type
Create Multiplication Table from 1 to 10
Create Multiplication Table in Java In this section, you will learn how to create multiplication table from 1 to 10. For this purpose, we have created...]; for (int i=1; i<array.length; i++) { for 
New Page 1
JavaScript loop through In this Tutorial we want to describe you a code that help you in understanding JavaScript loop through. We are using Java Script...;= 1; i <= 9; i++){   for(var j = 1
Chapter 1. EJB Overview
 Chapter 1. EJB OverviewPrev Part I. Exam Objectives Next    Chapter 1. EJB... the Write Once, Run Anywhere™ philosophy of the Java programming
Core Java Interview Question Page 1
Core Java Interview Question Page 1       Question: How could Java classes... classes, you have to inherit your class from it and Java does not allow multiple
Struts 2 Integration with Struts 1
Struts 2 Integration with Struts 1  I want to integrate struts 2 with struts 1 existing application. Can you please help on how to go about this. I am not finding any good source to integrate struts 2 with struts 1 framework
Cohabitation struts 1 and 2 - Struts
Cohabitation struts 1 and 2  Hi, I have a problem with the cohabitation of struts 1 and 2. I work on a web application which used struts 1. But i must add some functionality in struts 2. When i modify my web.xml file
Simple Linked List Exercise 1
Java Notes: Simple Linked List Exercise 1 Name: ___________________________________________ Fill in the blanks to for this program that reads strings and puts them in a doubly linked list. 1 2 3 4 5 6 7 8
Solving task 1 by 1 from bundle of task data
Solving task 1 by 1 from bundle of task data  Hello and namaste guys, i really need help here.i use ResultSet to query data from database. as we know... set.what should i do so that the solve code solve data 1 by 1?do i need to use
Advertisements
 

 

 

DMCA.com