Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Java program that grades a vocab test with ten code terms(Q&A below). T

ID: 3668363 • Letter: C

Question

Create a Java program that grades a vocab test with ten code terms(Q&A below). The user will enter a response to the questions that are asked and there will be the list of words at the top of each question using System.out.println. Then when they have finished the test only a letter grade should be printed (A ,B ,C, D ,or F). A Scanner should be used for the code and the code should be written with very basic Java programming(very simple). The terms that should be used and questions that correspond with them are as followed:

------------------------------------------------------------------------------------------------------------------------------

What modifies an object on which it is invoked?
Answer: Mutator Method

What merely accesses information without making any modifications?
Answer: Accessor Method

What classes have only accessor methods and no mutator methods?
Answer: Immutable

What is any kind of modification of data that is observable outside the method?
Answer: Side Effect

A requirement that the caller of a method must obey is a…?
Answer: Precondition

What disrupts the normal flow of a programs execution?
Answer: Throw an Exception

What condition will be fulfilled as long as the precondition is?
Answer: Postcondition

What is a method not invoked by an object called?
Answer: Static Method

What operates on a particular instance of objects?
Answer: Instance Methods

What is a variable that’s declared within the body of a method?
Answer: Local Variable

Explanation / Answer

Grading scale was not mentioned so I have used my own.

Question.java

import java.util.*;
public class Question {

   public static void main(String[] args) {
      
       Scanner input = new Scanner(System.in);
      
       int score=0;
       String ans="";
       System.out.println("What modifies an object on which it is invoked?");
       ans=input.nextLine();
       String correctAns="Mutator Method";
       if(ans.equals(correctAns))
       {
           score++;
       }
       System.out.println("Answer: "+ans);
      
       System.out.println("What merely accesses information without making any modifications?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Accessor Method"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);
      
       System.out.println("What classes have only accessor methods and no mutator methods?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Immutable"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);
      
       System.out.println("What is any kind of modification of data that is observable outside the method?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Side Effect"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);

       System.out.println("A requirement that the caller of a method must obey is a…?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Precondition"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);

       System.out.println("What disrupts the normal flow of a programs execution?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Throw an Exception"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);

       System.out.println("What condition will be fulfilled as long as the precondition is?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Postcondition"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);

       System.out.println("What is a method not invoked by an object called?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Static Method"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);

       System.out.println("What operates on a particular instance of objects?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Instance Methods"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);
      
       System.out.println("What is a variable that’s declared within the body of a method?");
       ans=input.nextLine();
       if(ans.equalsIgnoreCase("Local Variable"))
       {
           score++;
       }
       System.out.println("Answer: "+ans);

       //Grading based on score
       if(score>8)
       {
           System.out.println("Your grade for this test is A");
       }
       else if(score>6)
       {
           System.out.println("Your grade for this test is B");
       }
       else if(score>4)
       {
           System.out.println("Your grade for this test is C");
       }
       else if(score>3)
       {
           System.out.println("Your grade for this test is D");
       }
       else
       {
           System.out.println("Your grade for this test is F");
       }
   }
}