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
nataly862011 [7]
3 years ago
15

A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output i

s the miles walked. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: printf("%0.2lf", yourValue);
Computers and Technology
2 answers:
kenny6666 [7]3 years ago
7 0

Answer:

steps = int(input("Enter the number of steps: "))

miles = steps / 2000

print('{:.2f}'.format(miles))Explanation:

Explanation:

Amanda [17]3 years ago
6 0

Answer:

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

   Scanner in = new Scanner(System.in);

   //Prompt and receive user input

       System.out.println("Enter number of Steps");

       int numSteps = in.nextInt();

       double numMiles = numSteps/2000;

       //Print the formated number of miles

       System.out.printf("The equivalent miles is %.2f ",numMiles);

   }

}

Explanation:

  • This is solved using Java programming language
  • Scanner class is imported and used to receive user input (number of steps walked)
  • To convert number of steps to number of miles, we divide by 2000, Since the question says the pedometer treats walking 2,000 steps as walking 1 mile.
  • Output the number of miles to 2 decimal places using java's printf() method
You might be interested in
This loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.1. do-while
Luba_88 [7]

Answer:

Option 3 is the correct answer.

Explanation:

  • In c, c++ or Java programming language, The for loop takes three parameters in which first is an initialization, second is condition check and the third is an increment. None of the other loop (except for loop) takes three parameters. The other loop takes only one parameter and that is the condition check.
  • So when a user knows about the times of iteration then it is a good choice to use the for loop but when the person does not know about the times of iteration if the loop. It means the iteration of the loop is based on the condition then it is a good choice to chose while or Do-while loop.
  • The above question wants to ask which loop for a user can best if he familiar with the iteration of the loop then the answer is for loop which is started from option 3. Hence Option 3 is the correct answer while the other is not because--
  1. Option 1 states about the do-while loop which takes condition only.
  2. Option 2 states about the while loop which also takes condition only.
  3. Option 4 states about the infinite loop which is not any loop.
  4. Option 5 states about none of these which is not correct because option 3 is the correct answer.

6 0
3 years ago
Write a program that prompts the user for the lengths of the two legs of a right triangle, and which reports the length of the h
timurjin [86]

Answer: The following code is in c++

#include <iostream>

#include<math.h>

using namespace std;

int main()

{

   float a,b,c;

   cout<<"Enter height and base of triangle\n";

   cin>>a>>b;  //reading two sides from user

   c=sqrt(pow(a,2)+pow(b,2));  //calculating hypotenuse

   cout<<"Length of hypotenuse is "<<c;  //printing third side of triangle

   return 0;

}

OUTPUT :

Enter height and base of triangle                                                                                            

3                                                                                                                              

4                                                                                                                              

Length of hypotenuse is 5  

Explanation:

In the above code, three variables a, b and c of int type are declared. After that, it is asked from user to enter the value of a and b. The user puts the value and then c is calculated with the help of Pythagoras theorem formulae which squares the values of two sides and then adds them to calculate hypotenuse of a right angled triangle and finally c is printed to console.

3 0
3 years ago
What are threats to computer system
4vir4ik [10]
Breach..
bugs and viruses
hack
3 0
3 years ago
Read 2 more answers
Describe at least three things you could do to prepare for giving an effective and engaging business presentation. (1-3 sentence
puteri [66]
To prepare for giving an effective and engaging business presentation;
1. Know your subject and be able to answer questions.
2. Practice your presentation until you are confident in your delivery
3. Get plenty of sleep the night before and have a light breakfast the day of.
4 0
3 years ago
Read 2 more answers
write a 2d array c program that can capture marks of 15 students and display the maximum mark, the sum and average​
bekas [8.4K]

Answer:

#include <stdio.h>  

int MaxMark(int* arr, int size) {

   int maxMark = 0;

   if (size > 0) {

       maxMark = arr[0];

   }

   for (int i = 0; i < size; i++) {

       if (arr[i] > maxMark) {

           maxMark = arr[i];

       }

   }

   return maxMark;

}

int SumMarks(int* arr, int size) {

   int sum = 0;

   for (int i = 0; i < size; i++) {

       sum += arr[i];

   }

   return sum;

}

float AvgMark(int* arr, int size) {

   int sum = SumMarks(arr, size);

   return (float)sum / size;

}

int main()

{

   int student0[] = { 7, 5, 6, 9 };

   int student1[] = { 3, 7, 7 };

   int student2[] = { 2, 8, 6, 1, 6 };

   int* marks[] = { student0, student1, student2 };

   int nrMarks[] = { 4, 3, 5 };

   int nrStudents = sizeof(marks) / sizeof(marks[0]);

   for (int student = 0; student < nrStudents; student++) {              

       printf("Student %d: max=%d, sum=%d, avg=%.1f\n",  

           student,

           MaxMark(marks[student], nrMarks[student]),

           SumMarks(marks[student], nrMarks[student]),

           AvgMark(marks[student], nrMarks[student]));

   }

   return 0;

}

Explanation:

Here is an example using a jagged array. Extend it to 15 students yourself. One weak spot is counting the number of marks, you have to keep it in sync with the array size. This is always a problem in C and would better be solved with a more dynamic data structure.

If you need the marks to be float, you can change the types.

3 0
2 years ago
Other questions:
  • What is basic function of an operating system?
    10·2 answers
  • This is not school related in anyway but. I used to play this videogame on my computer years ago, but i cannot remember the name
    13·2 answers
  • Why are computer messages encapsulated?
    13·1 answer
  • How do you validate the type of text that a user enters?
    7·1 answer
  • Cual es la herramienta de google que funciona como oficce ?
    11·1 answer
  • With which type of social engineering attack are users asked to respond to an email or are directed to a website where they are
    9·1 answer
  • - What are the different types of clients?
    12·1 answer
  • Write a program in python to test if given number is prime or not.
    6·2 answers
  • Write a code that takes numbers from the user as a list. (User can enter as many numbers as he wants). Then, find mean and stand
    15·1 answer
  • Pleasee helpppppppppppppppppppppp me!
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!