Ask Question
4 March, 10:10

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. 4 March, 13:19
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers