1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
pogonyaev
3 years ago
5

One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input

, and outputs the number of laps. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); Ex: If the input is:
Computers and Technology
2 answers:
Sedaia [141]3 years ago
6 0

Answer:

def miles_to_laps(miles):

  return miles / 0.25

miles = 5.2

num_of_lap = miles_to_laps(miles)

print("Number of laps for %0.2f miles is %0.2f lap(s)" % (miles, num_of_lap))

Explanation:

salantis [7]3 years ago
5 0

Answer:

import java.util.Scanner;

public class Miles {

public static void main(String[] args) {

   //initialization

       double Number_Miles;

       //print the message

       System.out.print("Enter the number of miles: ");

       Scanner scn1 = new Scanner(System.in);

       

       Number_Miles = scn1.nextDouble();  //read the input from user

       //calculate the laps

       double yourValue = Number_Miles/0.25;

       //display the output on the screen

       System.out.printf("%.2f", yourValue);

     

}

}  

Explanation:

First import the library Scanner than create the class and define the main function. In the main function, declare the variables.

print the message on the screen and then store the value enter by the user into the variable.

Scanner is a class that is used for reading the output. So, we make the object of the class Scanner and then object call the function nextDouble() which reads the input and store in the variable.

After that, calculate the number of laps by dividing the number of miles with the given one lap running track value (0.25 miles).

Number\,of\,laps = \frac{Number\,of\,miles}{0.25}

the output is stored in the variable.

After that, print the value on the screen with 2 digits after the decimal point.

we can use "%.2f" in the printing function in java.

like System.out.printf("%.2f", output);

You might be interested in
A termination condition in a loop is analogous to________in a recursive method.
Varvara68 [4.7K]

Answer:

b) iteration.

Explanation:

There are various algorithms which are used in computer programming. Iteration is also a type of algorithm which is used to create loops. The instructions are inserted once and then these instructions are repeated to create a loop function.

8 0
3 years ago
Yo who do u add a pic on here
Juliette [100K]
Go to the me colum when you first open the app
8 0
3 years ago
Who is the author of computer programming pdf
mash [69]
Donald Knuth<span> began the project, originally conceived as a single book with twelve chapters, in 1962.</span>
5 0
3 years ago
Where is Peru located?
Illusion [34]
B. South America

[ignore:20 CHARACTERS]
4 0
3 years ago
What is a computer meaning
goldenfox [79]

Answer:

computer means an electronic machine which process raw data and gives meaningful information to the user

7 0
3 years ago
Other questions:
  • A ______________ is a document created when planning resource management to help promote teamwork and clarify team communication
    13·1 answer
  • To download a webpage, the web browser copies files and transfer them to your ____
    14·2 answers
  • 1. What is the difference between a learner’s license and an operator’s license?
    10·1 answer
  • What microprocessor was the first to be processable<br> ?
    14·1 answer
  • A device capable of copying a graphic, document, or other object is called a
    7·2 answers
  • Why was the personal computer an important invention?
    7·1 answer
  • Read the following scenario, and then answer the question below.
    15·2 answers
  • 3. State whether the given statements are true or false. a. The computer is called a data processor because it can store, proces
    13·1 answer
  • How do you render and export files on blender
    6·1 answer
  • Which image file format consumes the most file<br> space?<br> 0<br> GIF<br> JPEG<br> PNG
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!