Change code in java program so that input of floating point

Assignment Help JAVA Programming
Reference no: EM13941974

Change code in Java program so that input of floating point values is possible.

/* Java program which outputs the average speed of an
*object given the distance and time travelled
* (speed = distance/time). */

// Java extension packages
import java.util.*; // import class
import java.io.*; // import class

public class AverageSpeed
{
// main method begins execution of Java application
public static void main( String args[])
{

Scanner input = new Scanner( System.in );

int Distance; // Number keyed in by user representing distance travelled
int Time; // Number keyed in by user representing time taken
int Speed; // Calculated average speed

// Takes input of number to be process representing distance travelled
System.out.print( "Please enter the distance travelled in kilometres: ");
Distance = input.nextInt();

// Takes input of number to be process representing travel time
System.out.print( "Please enter the time taken to cover the distance in hours : ");
Time = input.nextInt();

Speed = Distance/Time; // Calculates the average speed

// display the results calculated average speed
System.out.printf( "Your average speed per hour is: %dn" , Speed );

} // end method main
} // end class AverageSpeed

Reference no: EM13941974

Questions Cloud

The start of an election season two candidate with extreme : Suppose at the start of an election season two candidate with extreme positions are running against each other.  the median voter model predicts that each candidate will become more moderate because __________.
Rate of inflation expected to prevail for the next year : As of today, the rate of inflation expected to prevail for the next year is 0.2% in the U.S. and 0.3% in the euro zone. What is the expected change in the exchange rate S($/€) for the next year?
Assume that the fair value of the hall division : Assume that the fair value of the Hall division is $1,950,000 instead of $2,100,000. Prepare the journal entry to record the impairment loss, if any, on December 31,2013.
Write an expression for the signal : Write an expression for the signal, Sc, in terms of R, the coating blackbody emissive power, the blackbody emissive power of the surroundings, the coating emissivity, and the appropriate band emission fractions
Change code in java program so that input of floating point : Change code in Java program so that input of floating point values is possible.
Find the maximum gain-the maximum loss : Assume you buy a European put option on €125,000. The strike price is X($/€)=1.09, the maturity is one year, and the premium is 3 cents per euro. Find the maximum gain, the maximum loss and the break-even point S($/€). Use 4 decimals for the exchange..
Trying to remove a very tight bolt : Mechanics sometimes put a length of pipe over the handle of a wrench when trying to remove a very tight bolt. How does this help? (It is also hazardous since it can break the bolt.)
Discuss the potential influences of power : Write a summary in which you critically discuss the potential influences of power and politics that can affect your scenario organisation. Explain the issues of power and politics that may arise within and across teams as a consequence of the pend..
Analyzing the leadership of a 21st century : Using relevant theories and models critically evaluate and analyse the leadership of a 21st century business leader (must be an Australian or American leader).

Reviews

Write a Review

JAVA Programming Questions & Answers

  The objective is to implement a menu-based system for bank

the objective is to implement a menu-based system for bank accounts in order to simulate a very simple banking system.

  Constructs a rectangle object

Write an AreaTester program that constructs a Rectangle object and then computes and prints its area. Use the getWidth and getHeight methods. Also print the unexpected answer.

  Write java statements to create a collection of integers

Write Java statements to create a collection of integers, and to initialize each element of the collection to -1. Then, using for each statement to print the value of each element.

  You will need a bottomuptwothreefourtree class with a

you will need a bottomuptwothreefourtree class with a bottomuptwothreetreefourtree constructor which takes no

  Using the java development kit and jgrasp

Using the Java Development Kit and jGrasp, develop a program in response to the following prompt:

  Write a java application to display the following gui

Write a Java application to display the following GUI. At this point you are only implementing the display. We are not ready to make the calculator actually do any calculations

  Write paper about focuses on the popularity of java

You will write a 4-5-page research-oriented paper in APA format that focuses on the "Popularity of Java"

  Java program the program has a page that shows the users

java program the program has a page that shows the users name and program name. a second jpanel that shows 4 buttons

  Modify the java application using java netbeans ide

Modify the Java application using Java NetBeans IDE to meet these additional and changed business requirements. The application will now compare the total annual compensation of at least two salespersons.

  Assignment in python

You will complete this assignment in Python 3.x. Make sure you have downloaded the software and it is installed correctly. You will download it from this site: https://www.python.org/downloads/.

  The frantic pipe layer game1 the completed gamehere is what

the frantic pipe layer game.1 the completed gamehere is what the user interface should look like when completedyou must

  An api for a library that provides for all these operations

Quaternions can be represented with four (4) real numbers (a,b,c,d). They can be added, subtracted, multiplied and divided. You can multiply a quaternion by a scalar (which produces a quaternion as a result)

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd