22.5k views
3 votes
Write a program named TypingGrades that allows a user to enter a student’s number of words typed. The output is the letter grade. For example, if 8 words typed is input, the output should be Typing 8 words per minute: Grade F.

User TonyH
by
4.4k points

1 Answer

6 votes

complete question:

Write a program named TypingGrades that allows a user to enter a student’s number of words typed. The output is the letter grade. For example, if 8 words typed is input, the output should be Typing 8 words per minute: Grade F.

Words typed Grade

0–15 F

16–30 D

31–50 C

51–75 B

76 and over A

Answer:

import java.util.Scanner;

public class TypingGrade {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.println("Enter number of words typed");

int numWords = in.nextInt();

if(numWords<=15){

System.out.println("Grade F");

}

else if(numWords>=16 && numWords<=30){

System.out.println("Grade D");

}

else if(numWords>=31&&numWords<=50){

System.out.println("Grade C");

}

else if(numWords>=51 && numWords<=75){

System.out.println("Grade B");

}

else{

System.out.println("Grade A");

}

}

}

Step-by-step explanation:

  • Using Java programming Language
  • Import Scanner Class to prompt and receive user input of number of words typed
  • Use if..elseif...else statements to test each condition (the range of words) given in the question to print the expected output.

User DuckMaestro
by
5.5k points