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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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