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
nalin [4]
3 years ago
12

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: 1.5 the output is: 6.00 Exc If the input is: 2.2 the output is: 8.80 Your program must define and call a method: public statie double milestoLaps (double userkiles) LAB ACTIVITY 6.23.1 LAB Miles to track laps 0/10 LabProgram java Lood default template1 import java.util.Scanner; 2 3 public class LabProgram 4 5 public static double wiles Tolaps(double userMiles) 6 return userMiles / 0.25; 7 89 10 Scanner in new Scanner (System.in); 11 System.out.printf(x 27, wilestoLaps(in.nextDouble()); 12 }13 14 }15
Computers and Technology
1 answer:
postnew [5]3 years ago
4 0

Answer:

import java.util.Scanner;

public class LapToMiles {

   public static void main(String[] args) {

       System.out.println("Enter Number of Miles");

       Scanner in = new Scanner(System.in);

       double numMiles = in.nextDouble();

       double numberOfLaps = milestoLaps(numMiles);

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

   }

   public static double milestoLaps(double numMiles){

       //One lap = 0.25 miles

       double numberOfLaps = numMiles/0.25;

       return numberOfLaps;

   }

}

Explanation:

Create a Method milestoLaps that converts number of laps to number of miles

Within the main method call milestoLaps and pass your entered value for miles

format the output with printf()

You might be interested in
What is the magnitude of the largest positive value you can place in a bool? a char? an int? a float?
MaRussiya [10]

Answer:

A bool can hold only true or false values.

A char can hold maximum 65535 characters.

An int can hold maximum positive value of 2,147,483,647.

A float can hold maximum positive value of 3.4 x 10^{38}.

Explanation:

Primitive data types in Java language can be categorized into boolean and numeric data types.

Numeric can be divided further into floating point and integral type. Floating data type includes float and double values while and integral data type which consists of char, int, short, long and byte data types.

Every data type has a range of values it can hold, i.e., every data type has a minimum and maximum predefined value which it is allowed to hold. The intermediate values fall in the range of that particular data type.

Any value outside the range of that particular data type will not compile and an error message will be displayed.

The data types commonly used in programming are boolean, char, int and float.

A boolean variable can have only two values, true or false.

A char variable can hold from 0 to 65535 characters. Maximum, 65535 characters are allowed in a character variable. At the minimum, a char variable will have no characters or it will be a null char variable, having no value.

An int variable has the range from minimum -2^{31} to maximum 2^{31} – 1. Hence, the maximum positive value an int variable can hold is (2^{31}) – 1.

A float variable can hold minimum value of 1.4 x 10^{-45} and maximum positive value of 3.4 x 10^{38}.

The above description relates to the data types and their respective range of values in Java language.

The values for boolean variable remain the same across all programming languages.

The range of values for char, int and float data types are different in other languages.

7 0
3 years ago
Java can be procedural or object-oriented when it comes to programming. What is the difference between procedural and OOP?​
Helen [10]

Answer:

Procedural Programming => Functions

Object-Oriented Programming => Classes

Explanation:

Procedural programming is essentially what it sounds like – it's a series of procedures that the computer executes out. A procedure is essentially a function built of different steps that you the coder have grouped as such.

Object-Oriented Programming is all about objects. Objects contain data in the form of attributes, and functions in the form of methods. The most popular Object-Oriented Programming languages are class based, meaning that each object is an instance of a class (the class being a template).

Hope that helps! And you can always research more online!

7 0
3 years ago
Who does Potholes effect in South Africa?
Morgarella [4.7K]
By definition, a pothole is a structure mostly located at the surface of roads and highways wherein it is usually characterised by having deep crevices which are primarily caused by extreme soil erosion or the presence of water in the area. In addition, these potholes greatly affect the transportation system of South Africa because the flow of traffic will be interrupted.
4 0
3 years ago
Sharing resources.
olya-2409 [2.1K]

Answer:

Explanation:

2- Multitasking Multitasking – Multitasking Multitasking is one among the main advantage of computer. ...

Speed – Now computer isn't just a calculating device. ...

Cost/ Stores huge – Amount of knowledge it's a coffee cost solution. ...

Accuracy – ...

Data Security – ...

Task completer – ...

Communication – ...

Productivity –

More items...•

6 0
2 years ago
Suzanne is following a fad diet. She has started to experience low energy during her workouts, and on a recent trip to the docto
Nastasia [14]

Answer:

Hi mate....

Explanation:

This is ur answer....

<em>-</em><em>-</em><em>></em><em> </em><em>Suzanne just facing low carbohydrates</em>....

hope it helps you,

mark me as the brainliest pls....

Follow me!

5 0
2 years ago
Read 2 more answers
Other questions:
  • All of the following statements correctly describe an advantage or disadvantage associated with the use of Monte Carlo Analysis
    9·1 answer
  • You press the power button in order to start your computer but hear nothing and see nothing. Name 2 possible reasons for this.
    6·1 answer
  • When Amy turns on her computer, she notices a burning smell. Smoke comes out of the case, and Amy immediately turns off her comp
    7·1 answer
  • 1. In the.js file, write the JavaScript code for this application. Within the click event handlers for the elements in the sideb
    14·1 answer
  • The ________ contains the central electronic components of the computer. select one:
    14·1 answer
  • Which of these options would likely have a better playback experience in your presentation?
    8·2 answers
  • What is the benefit of hosting a website on a personali
    6·1 answer
  • Would my phone still work if I snapped it in half?
    8·2 answers
  • DEFINE Problem:
    11·1 answer
  • If you were a hackathon team manager, how could you best address the conflict created by having more volunteers than open roles
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!