Question

In: Computer Science

PSUEDOCODE: Using whatever looping mechanism makes sense to you, create an algorithm that will display timing...

PSUEDOCODE: Using whatever looping mechanism makes sense to you, create an algorithm that will display timing for a stopwatch.

Keep the following in mind:

  • We can assume that you're processing on the world's oldest, slowest computer and that each iteration of a loop takes exactly one/100th of a second
  • The user needs to see fractions of a second all the way to 24 hours - any more and we should really call for medical help...
  • Provide a way for the user to be able to stop the procedure at any time

Solutions

Expert Solution

Here the question isn't giving a exact description of what is needed but I'll assume we need to print the time in a stop watch and the user to stop it at anytime.

Now there are two thing we have to do,

Check if user has tried to close us and if the time is 24hrs so we can the hospital where as in any other situation we just need to increase value by 1/100 of a second.

import sys

HR=0

Min=0

milli=0

second = 0

while(true):
    try: if(HR=23 and min==59 and Second ==59 and milli= 99):
               Print( " calling the hospital")
         elif(min==59 and second = 59 and Milli ==99):

HR +=1

min=0

second = 0

milli = 0

elif(second=59 and milli=99):

min+=1

second = 0

milli=0

elseif(Milli==99):

second+=1

milli=0

else:

milli+=1

print(Hr,":",minute,":",second,":",Milli)

   except KeyboardInterrupt:
          sys.exit()

Go over the code this will work if every loop takes 1/100 of a second of a millisecond and as soon as something is pressed it or will call hospital on completion of 24 hrs

Hope it helps


Related Solutions

1. Write pseudocode for the algorithm using iteration (looping). Envision an algorithm that when given any...
1. Write pseudocode for the algorithm using iteration (looping). Envision an algorithm that when given any positive integer n, it will print out the sum of the squares from 1 to n. For example given 3 the algorithm will print 14 (because 1 + 4 + 9 =14) You can use multiplication denoted as * in your solution and you do not have to define it (For example. 3*3=9) For example if n is 6 it will print: The sum...
Question 1: Using Python 3 Create an algorithm The goal is to create an algorithm that...
Question 1: Using Python 3 Create an algorithm The goal is to create an algorithm that can sort a singly-linked-list with Merge-sort. The program should read integers from file (hw-extra.txt) and create an unsorted singly-linked list. Then, the list should be sorted using merge sort algorithm. The merge-sort function should take the head of a linked list, and the size of the linked list as parameters. hw-extra.txt provided: 37 32 96 2 25 71 432 132 76 243 6 32...
solution using stack Reversing a word or a sentence: Write an algorithm that will display a...
solution using stack Reversing a word or a sentence: Write an algorithm that will display a given word in a reverse order. - e.g. "Data Structures" will be "serutcurtS ataD".
Bonding 8. a. Using whatever method you like, determine the shape of CF4 b. Using whatever...
Bonding 8. a. Using whatever method you like, determine the shape of CF4 b. Using whatever method you like, determine the shape of HBr c. Using whatever method you like, determine the shape of PF3 d. Using whatever method you like, determine the shape of CO2
Create some ideas for new offerings from Broad Reach Sailing. Decide if it makes sense to...
Create some ideas for new offerings from Broad Reach Sailing. Decide if it makes sense to take on new partners and what the pros and cons might be in making this decision. Do you have what it takes to be a successful entrepreneur? Do you think successful entrepreneurs are born with these traits or if these traits be learned?
Create Kernel of a Strongly Connected Components using Kosaraju's Algorithm in Java. I have to create...
Create Kernel of a Strongly Connected Components using Kosaraju's Algorithm in Java. I have to create a Kernel DAG using the Strongly Connected Components found using Kosaraju's Algorithm. The input to the code is in the format. 5 \n 5 \n 1 0 \n 0 2 \n 2 1 \n 0 3 \n 3 4 The code will find the SCCs and print them to the screen, however, I need to find a way to construct a kernel based on...
Are there any scenarios that you can think of that makes more sense to get the...
Are there any scenarios that you can think of that makes more sense to get the money in the future versus today? What about lottery winnings? Would you prefer the winnings now or payouts over a period of time?
Using Eclipse IDE Create a Java Program/Class named MonthNames that will display the Month names using...
Using Eclipse IDE Create a Java Program/Class named MonthNames that will display the Month names using an array. 1. Create an array of string named MONTHS and assign it the values "January" through "December". All 12 months need to be in the array with the first element being "January", then "February", etc. 2. Using a loop, prompt me to enter an int variable of 1-12 to display the Month of the Year. Once you have the value, the program needs...
This project is much easier if you create an algorithm. If you understand the content of...
This project is much easier if you create an algorithm. If you understand the content of the Concurrency Basics Tutorial, this Project will be easy. If not, 40 hours of working on it won't help. I suggest reading the instructions slowly and carefully before reading the tutorial so that you will notice what is needed as you read. Then read them again, slowly and carefully. Using the concepts from the Concurrency Basics Tutorial I provided in Modules, write a program...
Using Excel, create scatter plots and display the regression equations for the following pairs of variables:...
Using Excel, create scatter plots and display the regression equations for the following pairs of variables: “MedAge” versus “Sales/SqFt” In your report, include the scatter plots. For each scatter plot, designate the type of relationship observed (increasing/positive, decreasing/negative, or no relationship) and determine what you can conclude from these relationships. Sales/SqFt 701.97 209.93 364.92 443.04 399.20 264.64 571.59 642.25 461.45 638.82 484.38 581.09 267.71 572.84 586.48 368.73 351.47 458.24 987.12 357.45 405.77 680.80 368.02 303.95 393.90 562.12 494.88 310.07 373.46...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT