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
kiruha [24]
3 years ago
4

You're a swimmer, and you want to compare all of your race times to find the fastest one. write a program that continuously take

s race times as doubles from standard input, until the input is no more races, at which point it should print out the time of your fastest race.
Computers and Technology
2 answers:
MArishka [77]3 years ago
8 0
This program is in pseudocode. Just translate it to your programming language.
Define the following variables
race time as an array of inputted values

Ask race times

Store race times

Ask if there are still races

If yes, loop ask and store races times
If no, display minimum race time in array
makkiz [27]3 years ago
4 0

To find the fastest race among the entire race, enter the race time in seconds and make a list to store them. After that create a loop that will continue till the last race is not completed. Now, compare the race times . In main function, enter the race time or enter no more races. Finally, print the fastest race value. The easiest code in python language is written below in MaxRace.py file.

Further explanation:

Code: MaxRace.py

raceTime=Input(“Enter the race time or enter ‘no more races’:”)

if raceTime!=”no more races”:

fastest_race_time=float(raceTime)

# compare the race times

while raceTime!=’no more races’:

compareTime=float(raceTime)

if fastest_race_time>compareTime:

fastest_race_time=compareTime

raceTime=input(“Enter the race time or enter ‘no more races’:  “)

#print the fastest race

print(fastest_race_time)

else:

print(raceTime)

Output:

Run the commands in python, the output will be looking as below:

Enter the race time or enter ‘no more races’: 49.0

Enter the race time or enter ‘no more races’: 52.0

Enter the race time or enter ‘no more races’: 39.0

Enter the race time or enter ‘no more races’: 23.6

52.0

Learn more:

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832  

Answer details:

Grade: College Engineering

Subject: Computer Science and Engineering

Chapter: Python Programming

Keyword:

Python, input, output, programming, statements,  loops, if-else, print,  while, body, main body, char, int, float, variables, race, time, maximum, compare, code, fastest, seconds

You might be interested in
APCS A: I'm reviewing an old ap test and can't get past this problem:
yaroslaw [1]

Answer:

The answer is "Option A"

Explanation:

Following are the complete code to these question:

public class Arr//defining a class-Arr

{

public static void main(String[] args)//main method  

{

        int [][] numbers={{1, 2, 3},{4,5,6}}; //defining 2D array numbers

for(int[] row : numbers) //use for loop that holds all array value into 1D  array

{

for (int n: row)//defining n variable that holds row array values  

{

System.out.print (n); //print n variable value

}

}

}

}

The code comment explains its functioning.

7 0
3 years ago
Write a function called count_vowels that accepts a string argument that represents a word and returns the number of vowels that
stellarik [79]

Answer:

public static int count_vowels(String str){

       String word = str.replaceAll("[^a-zA-Z0-9]", "");

       String text = word.toUpperCase();

       int lenOfString = text.length();

       int count =0;

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

           if(text.charAt(i)=='A'||text.charAt(i)=='E'||text.charAt(i)=='I'

                   ||text.charAt(i)=='O'||text.charAt(i)=='U'){

               count++;

           }

       }

       return count;

   }

Explanation:

This has been implemented using Java programming language.

Firstly, white spaces, special characters and punctions are removed from the string uisng the replaceAll() method

The string is converted to all upper cases

a for loop is used to count the number of vowels and store to a variable count

In the main method a call to count_vowels is done

<em>public class num1 {</em>

<em>    public static void main(String[] args) {</em>

<em>        String name = "David %$ !. gjak";</em>

<em>        System.out.println("The number of vowels in "+name+ " are "+count_vowels(name));</em>

<em>    }</em>

<em>    public static int count_vowels(String str){</em>

<em>        String word = str.replaceAll("[^a-zA-Z0-9]", "");</em>

<em>        String text = word.toUpperCase();</em>

<em>        int lenOfString = text.length();</em>

<em>        int count =0;</em>

<em>        for(int i =0; i<lenOfString; i++){</em>

<em>            if(text.charAt(i)=='A'||text.charAt(i)=='E'||text.charAt(i)=='I'</em>

<em>                    ||text.charAt(i)=='O'||text.charAt(i)=='U'){</em>

<em>                count++;</em>

<em>            }</em>

<em>        }</em>

<em>        return count;</em>

<em>    }</em>

<em>}</em>

<em />

The complete program with a Main method is given below

3 0
3 years ago
Vlad wants to include his goals and target in his résumé. He also wants to add how he can be beneficial to the company. In which
olga_2 [115]
You can show how you can benefit by your achievements so i would say B
6 0
3 years ago
What is a typeface?
zepelin [54]

ans . B a collection of similar fonts

8 0
3 years ago
You can establish a feeling of control on your first day by
Tatiana [17]

Answer:

b planning ahead for challenges you'll face

6 0
4 years ago
Other questions:
  • What is a lease? AA contract outlining the terms of a mortgage. BA contract outlining the terms under which a landlord agrees to
    15·1 answer
  • "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequen
    10·1 answer
  • The ability to anticipate and determine upcoming driving hazards and conditions are adversely affected by stress.
    10·1 answer
  • If you want to add text in an area of a slide where a content placeholder is not located, you can insert a(n) _______________.
    7·1 answer
  • A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never
    7·1 answer
  • Please help explain this calculator code.
    15·1 answer
  • What time is spellrd the same forwards and backwards​
    11·1 answer
  • Advantages of a grain crush​
    9·1 answer
  • Figure out what this says:<br><br> ?driew tib a kool ti seoD
    7·1 answer
  • Quick!! I'm TIMED!!!
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!