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
stealth61 [152]
4 years ago
9

Write a line of code to convert time to hours. Remember there are 60 minutes in an hour. Then write a line of code to calculate

the speed of each runner in miles per hour. Speed is distance divided by time.
Computers and Technology
2 answers:
Rudik [331]4 years ago
8 0

Answer:

int giventime;

float timetohours, distance, speed;

timetohours = giventime/60;

speed = distance/timetohours;

Explanation:

The steps to achieving the above solution are as follows:

1. Determine a name for the variables that will hold the values of each entity

2. Determine the data type of the variables in step 1

3. Declare the variables and their respective datatypes

4. perform the mathematical operations as requested

Before I explain in further the steps 1-4, let me define some key words.

<u></u>

1. <u>VARIABLE</u>: a variable in programming is where data/information can be stored. Usually variables are given distinct and unique names that depict what they store in a  wat. From the solution above, we have 4 variables:

  • giventime: this is the time that is given, this is the time that should be converted into hours(as stated in the question)
  • timetohours: this variable will hold the value of the converted giventime above to hours.
  • distance: this variable will hold the value of the distance that is known. This value will be given to us, which is one of the 2 parameters that will be used to calculate the speed.
  • Speed: this variable holds the value of the calculated speed. That is: distance divided by time.

2.  <u>DATATYPE: </u>A Since a variable can hold data,  we have to also determine what type of data such a variable is holding. Is the data a whole number? decimal? date format? string of characters? e.t.c. This determination of what kind of data is being held within a variable is called datatype. There are several classifications of Data(datatypes) but in this example we used 2 types. Let us define them:

  • Int: "int" is the short form for Integer. An integer datatype is a datatype classification for whole numbers that do not have any decimal place. Example 1, 200, 20000, 30000, are all integers, but 12.1 is not an integer.
  • float: a float datatype is a datatype that has a decimal place. Example of floats include 12.33, 0.2, 1.44 and so on.

Now lets go ahead to explain the steps we took in achieving the solution:

1. We determined the variable names to be used. From the question we know that we will need the following details:  

time that will be converted,

the result of the conversion,

the distance and also

the resulting speed. We created 4 variables for each of these parameter.

2 Determining the variable datatype is another task. first we know that time is given in whole numbers(if not converted to hours yet, example: 20minutes, 33minutes, 46minutes and so on), so giventime will be an integer(int), however the converted time might not be a whole number, example 33 minutes will be 0.55hours. This number has a decimal place and thus we define the converted time(timetohours) as a float datatype. After that we have speed variable, we are not sure of what the resulting speed will be, however, since one of the parameters(time) that will be used to calculate the speed is already a Float datatype, there is a high tendency that the resulting value of speed will also be a float. In the light of this, we declare variable speed as float datatype. Next is the Distance, We do not know what value we will be given for the distance, so we make it open. Just in case we are not given an integer, thus distance datatype is set to float as well.

3. For the code to work, and the computer to understand our variables, we have to declare each of the variables that we have created. Declaring the variable simply means writing the variable's data type just before writing the variable. Example int giventime, float speed. In the first case, int is the datatype and the variable of datatype int is "giventime" , and in the second instance, float is the datatype andthe variable with this datatype is "speed"

4. Performing the mathematical operation:  

  • The first operation is converting the given time to hours. To get the corresponding hours for any given time, we simply divide the time by 60 to make an hour. Thus we have giventime/60 this will give us the resulting time in hours.
  • Second mathematical operation is calculating the speed: we have already been informed from the question, that speed is distance divided by time, so we divide the distance variable by the timetohours variable(the time which we have converted to hours) which gives us : distance/timetohours
DaniilM [7]4 years ago
5 0

Answer:

float time_hourly=(time_min/60);

float speed_mph=(distance_mil/time_hourly);

Explanation:

I have taken a float variable time_hourly to convert the time given in minutes in hours.We need to divide the time in minutes by sixty since there are 60 minutes in an hour.

I have taken a float variable speed_mph to calculate the speed.Since we know the speed is distance/time and provided the distance is in miles and the time is in hours.

You might be interested in
Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Everyti
Gemiola [76]

Answer:

b. cart total + 1

Explanation:

A. cart total=1 do increment the total with every 1 click here, it only 're-assigns cart total with value 1 for every click, hence it's always 1.

B. In every click, 1 is always added to the previous value of cart total, like addItemButton(cart total+1) or so.

C. This would have worked too if "cart total" and "cartTotal" where of same type.

D. cart total is just being initially defined here.

E. Likewise here, var shows that cart total has just only been declared.

6 0
3 years ago
I need some help with ideas
Troyanec [42]

Answer:

Maybe make a loud noise when there is an unacceptable speed

Explanation:

If you speed above the limit you will get a ticket to if it makes a loud noise you can be annoying and speed at the acceptable speed

5 0
3 years ago
While investing an email issue, a support technician discovers no user can access their email accounts on the company’s email se
Paul [167]

Answer:

The answer is D Check workstations on Lan for APIPA configuration.

Explanation:

1)

While investing an email issue, a support technician discovers no user can access their email accounts on the company’s email server connected to the private LAN.

Pinging the email server form several workstations on the LAN results in 0% packet loss.

Check workstations on Lan for APIPA configuration next step the technician should take in troubleshooting the issue.

7 0
3 years ago
Read 2 more answers
pls Which of the following statements is false? a. Having a first aid kit in an office is necessary b. Accidents happen, so it i
Dovator [93]
I thinks it’s B if not I’m sorry:)
7 0
3 years ago
Read 2 more answers
Create a program to compute the fee for parking in a garage for a number of hours. The program should: 1. Prompt the user for ho
Harman [31]

Answer:

The ans will be given in the python script below. A picture of the answer is also attached

Explanation:

print("Welcome To Garage Parking Fee Calculator")

hours = float(input("Type the number of hours parked :  "))

#fee per hour

rate = 2.40

#multiply rate per hour by the number of hours inputted

price = rate * hours

if price < 6:

   price = 6

if price > 20:

   price = 20

print("Parking fee is:  $", +price)      

7 0
3 years ago
Other questions:
  • You want to transfer a document from one computer to another, and you want the document to be encrypted. The destination compute
    14·1 answer
  • You are troubleshooting an IEEE 802.11 wireless client device that cannot connect to the wireless network. You notice the client
    14·1 answer
  • how to create a program that prime number include arraylist , and if not print the prime factors of the number.
    13·1 answer
  • Universal Containers has a bundle with many features. In one of these features, Feature A, all product options share the same Di
    5·1 answer
  • _______is the equal distribution of visual weight on either side of an imaginary axis through the center of a design. A building
    6·2 answers
  • What does festive mean
    11·2 answers
  • In a period of steep increases in interest rates, which issuer is most likely to be negatively affected? A Trucking company B Ut
    9·2 answers
  • What does this mean in python?
    5·1 answer
  • Community gardens are public gardens where local residents can grow plants in a plot. They are very popular, so there are often
    7·1 answer
  • What is networking??????????????????????
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!