Ask Question
13 June, 04:24

Write the definition of a function typing_speed, that receives two parameters. The first is the number of words that a person has typed (an integer greater than or equal to zero) in a particular time interval. The second is the length of the time interval in seconds (an integer greater than zero). The function returns the typing speed of that person in words per minute (a float).

+1
Answers (1)
  1. 13 June, 08:01
    0
    public static double typing_speed (int no_of_words, int no_of_sconds) {

    double time_in_minutes = (double) no_of_sconds/60;

    return (no_of_words/time_in_minutes);

    }

    Explanation:

    Using Java programming language, a method is created called typing_speed as required by the question. The method accepts two parameters of type ints no_of_words and no_of_seconds. A conversion of the second parameter (time in seconds) is done by diving by 60 and casting to a double data type Finally The typing speed (no of words/minute) is evaluated and returned See a complete code snippet with a main method below

    public class num10 {

    public static void main (String args[]) {

    int numWords = 17;

    int numSecs = 128;

    System. out. println ("The typing speed per minute is "+typing_speed (numWords, numSecs));

    }

    public static double typing_speed (int no_of_words, int no_of_sconds) {

    double time_in_minutes = (double) no_of_sconds/60;

    return (no_of_words/time_in_minutes);

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write the definition of a function typing_speed, that receives two parameters. The first is the number of words that a person has typed (an ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers