answer.
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
11Alexandr11 [23.1K]
2 years ago
7

Write a function nexthour that receives one integer argument, which is an hour of the day, and returns the next hour. This assum

es a 12-hour clock; so, for example, the next hour after 12 would be 1. Here are two examples of calling this function.
Computers and Technology
1 answer:
Alexandra [31]2 years ago
4 0

COMPLETE QUESTION:

Write a function nexthour that receives one integer argument, which is an hour of the day, and returns the next hour. This assumes a 12-hour clock; so, for example, the next hour after 12 would be 1. Here are two examples of calling this function.

>> fprintf('The next hour will be %d.\n', nexthour(3))

the next hour will be 4

>> fprintf('The next hour will be %d.\n', nexthour(12))

the next hour will be 1

Answer:

The following CODE in MATLAB will accomplish this

<em>>> nexthour = input('Please enter a time here: ');</em>

<em>if (nexthour >= 1) && (nexthour< 12)</em>

<em>nexthour = nexthour+ 1</em>

<em>elseif (nexthour == 12)</em>

<em>nexthour = 1</em>

<em>else </em>

<em>disp('You entered an invalid time')</em>

<em>end</em>

Explanation:

In the Matlab code above, the input function is used to receive a value for time in hours (1-12) next we use the if statement to check that the time entered is between 1 and 11 and add 1 as the next hour, else if the value entered is 12, we assign 1 as the next hour. For every other inputs an error message is displayed.

You might be interested in
Suppose that you need to maintain a collection of data whose contents are fixed- i.e., you need to search for and retrieve exist
Keith_Richards [23]

Answer:

Option a: a sorted array

Explanation:

Since the expectation on the data structure never need to add or delete items, a sorted array is the most desirable option. An array is known for its difficulty to modify the size (either by adding item or removing item). However, this disadvantage would no longer be a concern for this task. This is also the reason, linked list, binary search tree and queue is not a better option here although they offer much greater efficiency to add and remove item from collection.

On another hand,  any existing items from the sorted array can be easily retrieved using address indexing and therefore the data query process can be very fast and efficient.

4 0
2 years ago
#Write a function called string_finder. string_finder should #take two parameters: a target string and a search string. #The fun
adoni [48]

Answer:

I am writing a Python program:

def string_finder(target,search): #function that takes two parameters i.e. target string and a search string

   position=(target.find(search))# returns lowest index of search if it is found in target string

   if position==0: # if value of position is 0 means lowers index

       return "Beginning" #the search string in the beginning of target string

   elif position== len(target) - len(search): #if position is equal to the difference between lengths of the target and search strings

       return "End" # returns end

   elif position > 0 and position < len(target) -1: #if value of position is greater than 0 and it is less than length of target -1

       return "Middle" #returns middle        

   else: #if none of above conditions is true return not found

       return "not found"

#you can add an elif condition instead of else for not found condition as:

#elif position==-1    

#returns "not found"

#tests the data for the following cases      

print(string_finder("Georgia Tech", "Georgia"))

print(string_finder("Georgia Tech", "gia"))

print(string_finder("Georgia Tech", "Tech"))

print(string_finder("Georgia Tech", "Idaho"))

Explanation:

The program can also be written in by using string methods.

def string_finder(target,search):  #method definition that takes target string and string to be searched

       if target.startswith(search):  #startswith() method scans the target string and checks if the (substring) search is present at the start of target string

           return "Beginning"  #if above condition it true return Beginning

       elif target.endswith(search):  #endswith() method scans the target string and checks if the (substring) search is present at the end of target string

           return "End" #if above elif condition it true return End

       elif target.find(search) != -1:  #find method returns -1 if the search string is not in target string so if find method does not return -1 then it means that the search string is within the target string and two above conditions evaluated to false so search string must be in the middle of target string

           return "Middle"  #if above elif condition it true return End

       else:  #if none of the above conditions is true then returns Not Found

           return "Not Found"

6 0
2 years ago
List at least six things you would check for if you were asked to evaluate the workspace of an employee for ergonomics
Evgen [1.6K]

Assessing the risk that surrounds stationary work of employees spending hours at their stations is essential. Below is a list of fundamental ergonomic principles that help identify ergonomic risk factors.


<span>1.       </span>Are the employees maintained in a neutral posture?

<span>2.       </span>Does the stationery allow for movement and stretching?

<span>3.       </span>Is there adequate lighting?

<span>4.       </span>Are chairs adequately adjustable?

<span>5.       </span>Are there appropriate foot rest?

<span>6.       </span>Is there extra storage for better desk organization?






0 0
2 years ago
Which Artificial Intelligence (AI) term is used to describe extracting information from unstructured text using algorithms?
Alla [95]

Answer:

The most basic and useful technique in NLP is extracting the entities in the text. It highlights the fundamental concepts and references in the text. Named entity recognition (NER) identifies entities such as people, locations, organizations, dates, etc. from the text.

5 0
2 years ago
Drag each tile to the correct box.
Likurg_2 [28]
Learning
planning
designing
developing
testing delivering
4 0
2 years ago
Other questions:
  • In three to four sentences, describe why CEOs (the chief executive officers, that is, the leaders of large companies) make very
    9·1 answer
  • Mike has never used a slide software before, but he needs to create a presentation by the end of the week. what recourse would b
    8·1 answer
  • Write a program to help you feed your friends at a party by doing some math about square pizzas. Assume the grader defines a str
    12·1 answer
  • Write a program trapezoid.cpp that prints an upside-down trapezoid of given width and height. However, if the input height is im
    14·1 answer
  • Given an int variable k, an int array incompletes that has been declared and initialized, an int variable studentID that has bee
    10·1 answer
  • Server farms such as Google and Yahoo! provide enough compute capacity for the highest request rate of the day. Imagine that mos
    12·1 answer
  • What is the average number of nodes accessed in search for a particular element in an unordered list? In an ordered list? In an
    6·1 answer
  • Arrays are described as immutable because they are two dimensional. are arranged sequentially. can be reordered. cannot be chang
    13·1 answer
  • Write code which takes two inputs from the user, a number of sides followed by a side length, then creates a regular polygon wit
    10·2 answers
  • The height of a small rocket y can be calculated as a function of time after blastoff with the following piecewise function: y 5
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!