Write a program that asks for the names of three runners and the time, in minutes, it took each of them to finish a race. The program should display the names of the runners in the order that they finished.

Answers

Answer 1

Answer:

Written in Python

names = []

times = []

for i in range(0,3):

     nname = input("Name "+str(i+1)+": ")

     names.append(nname)

     time = input("Time "+str(i+1)+": ")

     times.append(time)

if times[2]>=times[1] and times[2]>=times[0]:

     print(names[2]+" "+times[2])

     if times[1]>=times[0]:

           print(names[1]+" "+times[1])

           print(names[0]+" "+times[0])

   else:

           print(names[0]+" "+times[0])

           print(names[1]+" "+times[1])

elif times[1]>=times[2] and times[1]>=times[0]:

     print(names[1]+" "+times[1])

     if times[2]>times[0]:

           print(names[2]+" "+times[2])

           print(names[0]+" "+times[0])

     else:

           print(names[0]+" "+times[0])

           print(names[2]+" "+times[2])

else:

     print(names[0]+" "+times[0])

     if times[2]>times[0]:

           print(names[2]+" "+times[2])

           print(names[1]+" "+times[1])

     else:

           print(names[1]+" "+times[1])

           print(names[2]+" "+times[2])

Explanation:

I've added the full source code as an attachment where I used comments to explain difficult lines


Related Questions

List three hardware computer components? Describe each component, and what its function is.

Answers

Answer:

moniter: a screen and is used to see what the computer is running

webcam: the camera on the computer. can be already built in or added

power supply: an electrical device that supplies power to an electrical load

Explanation:

Answer:

Input device

output device

C.P.U

The state way of grading drivers is called what?

*

Answers

Oh yeah I forgot what you did you do that I mean yeah I forgot to tell you something about you lol lol I don’t want to see it anymore

When investigators find evidentiary items that aren't specified in a warrant or under probable cause what type of doctrine applies

Answers

search it up and it’ll tell you what doctrines it applies too

In this exercise you will debug the code which has been provided in the starter file. The code is intended to take two strings, s1 and s2 followed by a whole number, n, as inputs from the user, then print a string made up of the first n letters of s1 and the last n letters of s2. Your job is to fix the errors in the code so it performs as expected (see the sample run for an example).
Sample run
Enter first string
sausage
Enter second string
races
Enter number of letters from each word
3
sauces
Note: you are not expected to make your code work when n is bigger than the length of either string.
1 import java.util.Scanner;
2
3 public class 02_14_Activity_one {
4 public static void main(String[] args) {
5
6 Scanner scan = Scanner(System.in);
7
8 //Get first string
9 System.out.println("Enter first string");
10 String s1 = nextLine(); 1
11
12 //Get second string
13 System.out.println("Enter second string");
14 String s2 = Scanner.nextLine();
15
16 //Get number of letters to use from each string
17 System.out.println("Enter number of letters from each word");
18 String n = scan.nextLine();
19
20 //Print start of first string and end of second string
21 System.out.println(s1.substring(1,n-1) + s2.substring(s1.length()-n));
22
23
24 }

Answers

Answer:

Here is the corrected program:

import java.util.Scanner; //to accept input from user

public class 02_14_Activity_one { //class name

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

    Scanner scan = new Scanner(System.in); //creates Scanner class object

  System.out.println("Enter first string"); //prompts user to enter first string

          String s1 = scan.nextLine(); //reads input string from user

  System.out.println("Enter second string"); //prompts user to enter second string

          String s2 = scan.nextLine(); //reads second input string from user

    System.out.println("Enter number of letters from each word"); //enter n

          int n = scan.nextInt(); //reads value of integer n from user

          System.out.println(s1.substring(0,n) + s2.substring(s2.length() - n ));

         } } //uses substring method to print a string made up of the first n letters of s1 and the last n letters of s2.

Explanation:

The errors were:

1.

Scanner scan = Scanner(System.in);

Here new keyword is missing to create object scan of Scanner class.

Corrected statement:

 Scanner scan = new Scanner(System.in);

2.

String s1 = nextLine();  

Here object scan is missing to call nextLine() method of class Scanner

Corrected statement:

String s1 = scan.nextLine();

3.

String s2 = Scanner.nextLine();

Here class is used instead of its object scan to access the method nextLine

Corrected statement:

String s2 = scan.nextLine();

4.

String n = scan.nextLine();

Here n is of type String but n is a whole number so it should be of type int. Also the method nextInt will be used to scan and accept an integer value

Corrected statement:

int n = scan.nextInt();

5.

System.out.println(s1.substring(1,n-1) + s2.substring(s1.length()-n));

This statement is also not correct

Corrected statement:

System.out.println(s1.substring(0,n) + s2.substring(s2.length() - n ));

This works as follows:

s1.substring(0,n) uses substring method to return a new string that is a substring of this s1. The substring begins at the 0th index of s1 and extends to the character at index n.

s2.substring(s2.length() - n ) uses substring method to return a new string that is a substring of this s2. The substring then uses length() method to get the length of s2 and subtracts integer n from it and thus returns the last n characters of s2.

The screenshot of program along with its output is attached.

Write a method called min that takes three integers as parameters and returns the smallest of the three values, such that a call of min(3, -2, 7) would return -2, and a call of min(19, 27, 6) would return 6. Use Math.min to write your solution.

Answers

Answer:

public class Main

{

public static void main(String[] args) {

 System.out.println(min(3, -2, 7));

}

public static int min(int n1, int n2, int n3){

    int smallest = Math.min(Math.min(n1, n2), n3);

    return smallest;

}

}

Explanation:

*The code is in Java.

Create a method named min that takes three parameters, n1, n2, and n3

Inside the method:

Call the method Math.min() to find the smallest among n1 and n2. Then, pass the result of this method to Math.min() again with n3 to find the min among three of them and return it. Note that Math.min() returns the smallest number among two parameters.

In the main:

Call the method with parameters given in the example and print the result

Methods are named program statements that are executed when called/invoked.

The method in Python, where comments are used to explain each line is as follows:

#This defines the method

def mmin(a,b,c):

   #This calculates the smallest of the three values using math.min

   minNum = min(a,b,c)

   #This prints the smallest value

   return minNum

Read more about methods at:

https://brainly.com/question/14284563

(d) Assume charArray is a character array with 20 elements stored in memory and its starting memory address is in $t5. What is the memory address for element charArray[5]?

Answers

Answer:

$t5 + 5

Explanation:

Given that ;

A character array defines as :

charArray

Number of elements in charArray = 20

Starting memory address is in $t5

The memory address for element charArray[5]

Memory address for charArray[5] will be :

Starting memory address + 5 :

$t5 + 5

Which of the following best describes open-source code software?
O A. a type of software that is open to the public and can be modified
B. a type of software that is free to download, but cannot be modified
C. a type of software that is locked, but can be modified
D. a type of software that has already been modified

Answers

Answer:

A. a type of software that is open to the public and can be modified.

Explanation:

Open-source refers to anything that is released under a license in which the original owner grants others the right to change, use, and distribute the material for any purpose.

Open-source code software is described as a type of software that is open to the public and can be modified. The correct option is A.

What is open-source code?

Open-source software is computer software that is distributed under a licence that allows users to use, study, change, and distribute the software and its source code to anyone and for any purpose.

Open-source software can be created collaboratively and publicly. Open-source refers to anything that is released under a licence that allows others to change, use, and distribute the material for any purpose.

Therefore, open-source code software is defined as software that is freely available to the public and can be modified. A is the correct answer.

To know more about open-source code follow

https://brainly.com/question/15039221

#SPJ6

Select the items that you may see on a Windows desktop.
Shortcuts to frequently used programs
System tray
Recycle Bin
Taskbar
O Database
Icons
O Quick Launch

Answers

Answer:

You may see:

The taskbar

The startmenu

Program icons within the taskbar

Shortcuts

Documents

Folders

Media files

Text files

The Recycle Bin

and so on...

What is a piece of information sent to a function

Answers

Answer:

the information sent to a function is the 'input'.

or maybe not hehe

What questions would you ask an employer at a job interview?

Answers

Answer:

8 Questions You Should Absolutely Ask An Interviewer

QUESTION #1: What do the day-to-day responsibilities of the role look like? ...

QUESTION #2: What are the company's values? ...

QUESTION #3: What's your favorite part about working at the company? ...

QUESTION #4: What does success look like in this position, and how do you measure it?

Explanation:

I hope this answer is Wright ,So please mark as brainlist answers

Shortest Remaining Time First is the best preemptive scheduling algorithm that can be implemented in an Operating System.

a. True
b. False

Answers

Answer:

a

Explanation:

Yes, true.

Shortest Remaining Time First, also popularly referred to by the acronym SRTF, is a type of scheduling algorithm, used in operating systems. Other times it's not called by its name nor its acronym, it is called the preemptive version of SJF scheduling algorithm. The SJF scheduling algorithm is another type of scheduling algorithm.

The Shortest Remaining Time First has been touted by many to be faster than the SJF

The answer to the question which asks if the Shortest Remaining Time First is the best preemptive scheduling algorithm that can be implemented in an Operating System is:

True

What is Shortest Remaining Time First?

This refers to the type of scheduling algorithm which is used to schedule tasks that would be executed in the processing unit in an Operating System based on the shortest time taken to execute the task.

With this in mind, we can see that this is the best preemptive scheduling algorithm that can be implemented in an Operating System because it makes task execution faster.

Read more about scheduling algorithm here:
https://brainly.com/question/15191620

CJ is developing a new website blogging about cutting-edge technologies for people with special needs. He wants to make the site accessible and user friendly.
CJ knows that some of the visitors who frequent his website will use screen readers. To allow these users to bypass the navigation, he will use a skip link, He wants to position the skip link on the right but first he must use the ____ property.
a) display
b) right
c) left
d) nav

Answers

Answer:

The answer is "Option c".

Explanation:

It is an internal page reference which, whilst also completely new pages, allow navigating around the current page. They are largely used only for bypassing and 'skipping' across redundant web page content by voice command users, that's why the CJ would use a skip link to enable those users to bypass specific navigation, and he also wants to put this link on the right, but first, he needs to use the left property.

there are no more than 60 people in a certain class to participate in the final .the exam subjects are programming, English, and mathematics .the following functions are realized by two dimensional array programming.calculate the average score of each student

Answers

Answer:

If there are many people in the class and if most of these people have never done such an intensive proof-based class, then I'd say this is not so surprising  that the class average would be 56%-34%

Explanation:

hopes this help this question threw me off a lot

You want to look up colleges but exclude private schools. Including punctuation, what would you
type?
O nonprofit college
O college -private
O private -college
O nonprofit -college

Answers

private-college. hope this helped :)

You want to look up colleges but exclude private schools. Including punctuation, The type is private -college. The correct option is c.

What are institutions of higher studies?

The institutions for higher studies are those institutions that provide education after schooling. They are colleges and universities. Universities, colleges, and professional schools that offer training in subjects like law, theology, medicine, business, music, and art are all considered higher education institutions.

Junior colleges, institutes of technology, and schools for future teachers are also considered to be part of higher education. There are different types of colleges, like government colleges and private colleges. Private colleges are those which are funded by private institutions.

Therefore, the correct option is c. private -college.

To learn more about excluding, refer to the link:

https://brainly.com/question/27246973

#SPJ2

the company has finished designing a software program but users aren't sure how to use it​

Answers

Answer:

The company should go back into the company and make it a little more easier to use or the company should put out an announcement or something so the people trying to use it know how

Explanation:

Mark me the brainliest please and rate me

Answer:

Several people in the human resources department need new software installed. An employee has an idea for a software program that can save the company time, but doesn't know how to write it.

Explanation:

Which online text source would include a review of a new TV show?
an academic journal
a blog
an e-book
an encyclopedia

Answers

Answer:

Blog

Explanation:

Online text sources include blogs, e-books, encyclopaedias, and e-zines. As a result, options A, B, C, and D are correct.

What is a text source?

A source is a book or other material that contains the data that has been used, whereas a citation is the actual statement of the starting point. They were researchers who also worked as professors, writers, and other professionals, and they published books and articles.

Online text sources are those that can be accessed from anywhere and are available on the internet. The online text shows that anyone can see or exceed including blogs, e-books, encyclopaedias, and e-zines.

These are available for further studies and research. Also to give information this can be a source. Therefore,  options A, B, C, and E is the correct option.

Learn more about text sources, here:

brainly.com/question/19131568

#SPJ6

Alice just wrote a new app using Python. She tested her code and noticed some of her lines of code are out of order. Which principal of programing should Alice review?

Answers

Answer:

sequencing

Explanation:

from flvs

Answer:

Sequencing

Explanation:

Assume you are using an array-based queue and have just instantiated a queue of capacity 10. You enqueue 5 elements, dequeue 5 elements, and then enqueue 1 more element. Which index of the internal array elements holds the value of that last element you enqueued

Answers

Answer:

The answer is "5".

Explanation:

In the queue based-array, it follows the FIFO method, and in the question, it is declared that a queue has a capacity of 10 elements, and insert the 5 elements in the queue and after inserting it enqueue 5 elements and at the last, it inserts an element 1 more element on the queue and indexing of array always start from 0, that's why its last element index value is 5.

Write a program that computes and display the n! for any n in the range1...100​

Answers

Answer:

const BigNumber = require('bignumber.js');

var f = new BigNumber("1");

for (let i=1; i <= 100; i++) {

 f = f.times(i);

 console.log(`${i}! = ${f.toFixed()}`);

}

Explanation:

Above is a solution in javascript. You will need a bignumber library to display the numbers in full precision.

To create a public key signature, you would use the ______ key.

Answers

Answer:

To create a public key signature, you would use the _private_ key.

Explanation:

To create a public key signature, a  private key is essential to enable authorization.

A private key uses one key to make data unreadable by intruders and for the data to be accessed the same key would be needed to do so.

The login details and some important credentials to access user data contains both the user's public key data and private key data. Both private key and public key are two keys that work together to accomplish security goals.

The public key uses different keys to make data readable and unreadable.

The public key is important to verify authorization to access encrypted data by making sure the access authorization came from someone who has the private key. In other words, it's a system put in place to cross-check the holder of the private key by providing the public key of the encrypted data that needed to be accessed. Though, it depends on the key used to encrypt the data as data encrypted with a public key would require a private key for the data to be readable.

Type the correct answer in the box
in which phishing technique are URLs of the spoofed organization misspelled?
anon
is a phishing technique in which URLs of the spoofed organization are misspelled

Answers

Answer: Link manipulation

Explanation:

Answer:

Typo Squatting

Explanation:

The reading element punctuation relates to the ability to

pause or stop while reading.

emphasize important words.

read quickly yet accurately.

understand word definitions.

Answers

Answer:

A

Explanation:

Punctations are a pause or halt in sentences. the first one is the answer so do not mind the explanation.

semi colons, colons, periods, exclamation points, and question Mark's halt the sentence

most commas act as a pause

Answer: (A) pause or stop while reading.

Explanation:

Choose the word to make the sentence true. The ____ function is used to display the program's output.

O input
O output
O display

Answers

The output function is used to display the program's output.

Explanation:

As far as I know this must be the answer. As tge output devices such as Monitor and Speaker displays the output processed.

The display function is used to display the program's output. The correct option is C.

What is display function?

Display Function Usage displays a list of function identifiers. It can also be used to display detailed usage information about a specific function, such as a list of user profiles with the function's specific usage information.

The displayed values include the prefix, measuring unit, and required decimal places.

Push buttons can be used to select functions such as summation, minimum and maximum value output, and tare. A variety of user inputs are available.

A display is a device that displays visual information. The primary goal of any display technology is to make information sharing easier. The display function is used to display the output of the program.

Thus, the correct option is C.

For more details regarding display function, visit:

https://brainly.com/question/29216888

#SPJ5

what is the use of buffer?​

Answers

Answer:

pH buffer or hydrogen ion buffer) is an aqueous solution consisting of a mixture of a weak acid and its conjugate base, or vice versa. ... Buffer solutions are used as a means of keeping pH at a nearly constant value in a wide variety of chemical applications.

Explanation:

there is your answer i got this one correct

hope it is helpful

Answer:

Limits the pH of a solution

Explanation:

A P  E X

Works in the public domain have copyright that are expired or abandoned true or false

Answers

Answer:

False

Explanation:

Only one of the two are true. Works in the public domain have a copyright that has expired only. E.g. Works of classical music artist, are almost always expired, in accorance with American Copyright law. Abandoning a copyright doesn't do anything because so long the copyright has remained unexpired, the copyright remains. Thats why it can take decades for a new movie in a series to release, like "IT" by Stephen King. The copyright hasn't expired but rather was 'abandoned'. Before "IT" 2017 was relasesed, the copyright was abandoned.

Which of the following documents has a template available in the online templates for your use?
letters
resumés
reports
all of the above

Answers

Answer:

The answer is all of the above.

Explanation:

Custom function definitions:________.
A. Must be written before they are called by another part of your program
B. Must declare a name for the function
C. Must include information regarding any arguments (if any) that will be passed to the function
D. all of the above

Answers

Answer:

D. all of the above

Explanation:

A option is correct and function definition must be written before they are called by another part of your program. But in languages such as C++ you can write the prototype of the function before it is called anywhere in the program and later write the complete function implementation. I will give an example in Python:

def addition(a,b): #this is the definition of function addition

    c = a + b

    return c    

print(addition(1,3)) #this is where the function is called

B option is correct and function definition must declare a name for the function. If you see the above given function, its name is declared as addition

C option is correct and function definition must include information regarding any arguments (if any) that will be passed to the function. In the above given example the arguments are a and b. If we define the above function in C++ it becomes: int addition( int a, int b)

This gives information that the two variables a and b that are parameters of the function addition are of type int so they can hold integer values only.

Hence option D is the correct answer. All of the above options are correct.

Other Questions
Who is the most beautiful woman in this world? Which option best describes the relationship between the two ideas below?Maggie Simpson made Oreo-flavored ice cubes. She putthree of the ice cubes in her milkshake is it Cause and Effect, example or Sequence what is the lenght of the diagonal of the rectangle will give brainlest The electrode is being __________ as you weld with it? Why is Justice Taney's argument ineffective?O He uses the freedom of African Americans asevidence.He uses a previous status of African Americans asevidence.O He uses the dissenting argument of the court asevidence.O He uses the ruling of the previous court as evidence. What physical property of the metal rods was being tested during step 4 of the procudure?4. Measure and record how long it takes heat from the hot plate set on "high" to melt the wax ball. A. magnetism B. thermal conductivity C. electrical conductivity D. density How does light travel so you can see in the dark Please help me.This is an excerpt from the website the Americas by high school student AllieDubecky:European colonization was the worst thing to ever happento indigenous populations in the Americas. But indigenouspeople should have known better than to trust Europeanexplorers. If they had put up more of a fight, perhaps theEuropean explorers would have decided not to createcolonies in the Americas.Which statement about the credibility of this source is most accurate?O A. The source is credible because it contains more facts thanopinions.O B. The source is not credible because it does not contain the dates ofthe events.O C. The source is credible because the author is an expert onindigenous people.O D. The source is not credible because it contains more opinions thanfacts. X - 6 < -4 please help The winner of the presidential election in 1800 wasJohn Adams.Aaron Burr.Thomas Jefferson.Charles Cotesworth Pinckney. Why was the first national government of the United States called a Confederation? Why would the Native Americans want to trade with the European Explorers? Who benefited the most from theColumbian Exchange? Who defined acting as the right management of the voice to express the various emotions?A)AristophanesB)AristotleC)SophoclesD)EuripidesE) none When Alfred Wegener first noticed that the continents fit together like puzzle pieces, this was Lena is staffing her new project, the construction of a beach resort with hotel, spa, and golf course. She is the architect on the project, and she knows she needs at least one experienced landscape architect to plan the sprawling grounds of the resort. What other staff members would you propose Lena should hire? (Select all that apply.) 1. At December 1, 2022, Swifty Corporation Accounts Receivable balance was $12770. During December, Swifty had credit sales of $34200 and collected accounts receivable of $27360. At December 31, 2022, the Accounts Receivable balance is:_______.a. $19610 credit.b. $1 debit.c. $46970 debit.d. $19610 debit.2. On July 7, 2017, Sheffield Corp. received cash $1480 for services rendered. The entry to record this transaction will include:_____. Human papilloma virus (HPV) greatly increases the risk of which cancer in women? Four times the sum of f and g is identical to six times g Help with math. please Which of the following is not a way for business owners to save labour costs? *automationconsolidationstaff trainingoutsourcing