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
Write a for loop to populate array userGuesses with NUM_GUESSES integers. Read integers using cin. Ex: If NUM_GUESSES is 3 and u
vlabodo [156]

Answer:

Follows are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main() //defining main method

{

const int NUM_GUESSES = 3;//defining an integer constant variable NUM_GUESSES

int userGuesses[NUM_GUESSES];//defining an array userGuesses

int i = 0;//defining integer variable i

for(i=0;i<NUM_GUESSES;i++)//defining for loop for input value

{

cin>>userGuesses[i];//input array from the user end  

}

for (i = 0; i < NUM_GUESSES; ++i)//defining for loop fore print value  

{

cout <<userGuesses[i] << " ";//print array value with a space

}

return 0;

}

Output:

9

5

2

9 5 2  

Explanation:

In the above-given program, an integer constant variable NUM_GUESSES is defined that holds an integer value, in the next step, an integer array "userGuesses" is defined, which holds NUM_GUESSES value.

In the next step, two for loop is defined, in the first loop, it is used for an input value, and in the second loop, it prints the array value.    

6 0
3 years ago
The frame work for storing records in database is a
andreev551 [17]
The frame work for storing records in database is a report. (b)
3 0
3 years ago
Which of the following postfix expressions corresponds to the given infix expression?
Ivan

Answer:

C) 1 4 2 / + 1 + 2 + 3 * 2 /

Explanation:

Infix, Postfix and Prefix are 3 different ways of writing expressions which differ in relative placement of operator and operands.

In Infix , operator lies between the operands whereas in postfix operator is written after its operands.

For example: 1 + 2 is infix while 1 2 + is the corresponding postfix expression.

Converting the given infix expression (1 + 4 / 2 + 1 + 2) * 3 / 2 to postfix:

Let (1 + 4 / 2 + 1 + 2) be represented by x.

Converting x to postfix:

(1 + 4 / 2 + 1 + 2)  =>  1 4 2 / + 1 + 2 +       ------------------------- (1)

So the overall infix expression becomes:

x * 3 / 2

Converting it to postfix:

x 3 * 2 /

Replacing the value of x from (1)

1 4 2 / + 1 + 2 + 3 * 2 /

4 0
3 years ago
(tco 2) c++ comments are represented by which characters?
Margarita [4]
(TCO 2) In C++ terminology, (Points : 4) a ... a class object is the same as a class instance. a class object is the same as a class member. a class object is the same as a class access specifier.
4 0
3 years ago
What are the information ethics associated with IP
Naily [24]

Answer:

The IP stands for intellectual property. And the information ethics related to the IP are the transaction privacy, piracy and the privacy for the ease and giveaways, investigation, namelessness. The trade details must be kept private, and not disclosed to anybody, and the piracy is never allowed. Also, the privacy of all sorts must be ensured for ease and giveaways, surveillance, and confidentiality.

Explanation:

Please check the answer section.

3 0
4 years ago
Other questions:
  • Write an application that encodes English-language phrases into pig Latin. Pig Latin is a form of coded language. There are many
    8·1 answer
  • I need help RIGHT NOW PLZ!!!!!!!!!!!!! this is due in 5 mins
    13·1 answer
  • HELP QUICK!!!
    14·2 answers
  • Your project must satisfy the following requirements:
    7·1 answer
  • Output devices reproduce or display which of the following
    12·2 answers
  • What private service may occur on a web server?
    7·1 answer
  • NEED FIVE QUESTIONS ANSWERED!!!
    7·1 answer
  • The ____ contains app buttons that allow you to quickly run the File Explorer or Microsoft Edge apps.
    12·1 answer
  • Question 1 (1 point)
    13·1 answer
  • Why star topology is more reliable than bus or ring topologies
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!