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
MrRissso [65]
4 years ago
14

LAB: Miles to track laps. (PLEASE CODE IN PYTHON)

Computers and Technology
2 answers:
vagabundo [1.1K]4 years ago
4 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:

bekas [8.4K]4 years ago
3 0

Answer:

The program in python is as follows:

def miles_to_laps(user_miles):

     return (user_miles/0.25)

mile = float(input("Number of Miles: "))

print("Number of laps: ",end="")

print('{:.2f}'.format(miles_to_laps(mile)))

Explanation:

The first line defines the function miles_to_lap

def miles_to_laps(user_miles):

This line returns the equivalent number of laps

     return (user_miles/0.25)

The main method starts here

This line prompts user for input

mile = float(input("Number of Miles: "))

This line prints the string "Number of laps", without the quotes

print("Number of laps: ",end="")

This prints the equivalent number of laps to two decimal places

print('{:.2f}'.format(miles_to_laps(mile)))

You might be interested in
Print person1's kids, call the incNumKids() method, and print again, outputting text as below. End each line with a newline.
Hatshy [7]

Answer:

Hi there! This is a good question to grasp the concepts of object-oriented classes, encapsulation and abstraction of classes and their properties in Java. Please find the details below.

Explanation:

You can implement the solution by calling the getNumKids() function of the personInfo object or directly using the personKid input from the user to display the initial number of kids for the user. Then, calling the incNumKids() increases the kids count. Finally, displaying the new number of kids is done by invoking the getNumKids() method of the PersonInfo object that returns the private property of numKids to the user. The user cannot access this property without the get and set methods.

CallPersonInfo.java =====

import java.util.Scanner;

public class CallPersonInfo {

public static void main (String [] args) {

Scanner scnr = new Scanner(System.in);

PersonInfo person1 = new PersonInfo();

int personsKid;

personsKid = scnr.nextInt();

person1.setNumKids(personsKid);

System.out.println("Kids: " + personKid); // or person1.getNumKids();

   person1.incNumKids();

   System.out.println("New baby, kids now: " + personInfoObject.getNumKids());

 

}

}

You can also write the code in the same file as PersonInfo.java as below.

import java.util.Scanner;

class PersonInfo {

 private int numKids;

 public void setNumKids(int setPersonsKids) {

   numKids = setPersonsKids;

 }

 public void incNumKids() {

   numKids = numKids + 1;

 }

 public int getNumKids() {

   return numKids;

 }

 public static void main(String args[]) {

   System.out.println("Enter number of kids: ");

   Scanner scan = new Scanner(System.in);

   int num_kids = scan.nextInt();

   PersonInfo personInfoObject = new PersonInfo();

   personInfoObject.setNumKids(num_kids);

   System.out.println("Kids: " + num_kids);

   personInfoObject.incNumKids();

   System.out.println("New baby, kids now: " + personInfoObject.getNumKids());

 }

}

5 0
3 years ago
At one time, a station sign-off test pattern was designed so TV owners could adjust the quality of their picture and sound
mamaluj [8]

Answer:

true

Explanation:

7 0
3 years ago
How to create PowerPoint presentation computer networking using visual diagrams
DanielleElmas [232]

https://www.google.com/url?sa=t&source=web&rct=j&url=https://support.office.com/en-us/article/video-create-a-network-diagram-a2360cd9-5c9d-4839-b4f6-17b485e02262&ved=2ahUKEwjlr4bdjd7hAhUiyYUKHR1UC1EQwqsBMAB6BAgLEAU&usg=AOvVaw3ZFpgzww1z4gFaeRCROkF-

7 0
3 years ago
PLSS HELP ASAP ILL GIVE BRAINLIEST THANKS
Svet_ta [14]
Second one i’m pretty sure
3 0
2 years ago
To construct a battery with a current of 6 A, you would connect six 1 A cells
m_a_m_a [10]
A. in parallel.,<span>D. in series.</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • If a local DNS server cannot find an IP address for a specified URL, it does this.
    9·1 answer
  • Suppose you want to write a program that will read a list of numbers from a user, place them into an array and then compute thei
    7·1 answer
  • Regarding the systems development​ process, ________ addresses the​ question, "Is the system producing the desired​ results?"
    12·1 answer
  • What is the name of the option in most presentation applications with which you can modify slide elements?
    9·2 answers
  • Your boss wants you to devise a way for remote contractors to be able to access the server desktop. There is one stipulation, ho
    8·2 answers
  • PYTHON Write a grade program using a function called computegrade that takes a score as its parameter and return a grade as a st
    8·1 answer
  • g Define several forms of metadata that can be useful to an investigation. How are valuable to an investigator
    10·1 answer
  • A website must have a unique address with all the following features
    14·1 answer
  • No down payment, 18 percent / year, payment of $50/month, payment goes first to interest, balance to principal. Write a program
    9·1 answer
  • What equipment allows a computer to connect to the internet.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!