SHARE
TWEET

Untitled

a guest Oct 17th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2.  
  3. public class AdditionQuiz_03_10 {
  4.   public static void main(String[] args) {
  5.     // 1. Generate two random single-digit integers
  6.  
  7.  
  8.     // 2. Prompt the student to answer "what is number1 + number2?"
  9.  
  10.  
  11.     // 4. Grade the answer and display the result
  12.     String replyString;
  13.     if (number1 + number2 == answer)
  14.       replyString = "You are correct!";
  15.     else
  16.       replyString = "Your answer is wrong.\n" + number1 + " + "
  17.         + number2 + " should be " + (number1 + number2);
  18.    
  19.     System.out.println(replyString);
  20.   }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top