question archive Complete the Riddle class below and complete the main method to construct 2 Riddle objects and call their printQuestion() and printAnswer() methods

Complete the Riddle class below and complete the main method to construct 2 Riddle objects and call their printQuestion() and printAnswer() methods

Subject:ManagementPrice: Bought3

Complete the Riddle class below and complete the main method to construct 2 Riddle objects and call their printQuestion() and printAnswer() methods.

 

public class Riddle

{

  // write 2 instance variables for Riddle's question and answer: private type variableName;

 

 

  // constructor

  public Riddle(String initQuestion, String initAnswer)

  {

   // set the instance variables to the init parameter variables

 

  }

 

  // Print riddle question

  public void printQuestion()

  {

   // print out the riddle question with System.out.println

 

  }

 

  // Print riddle answer

  public void printAnswer()

  {

   // print out the riddle answer with System.out.println

 

  }

 

  // main method for testing

  public static void main(String[] args)

  {

   // call the constructor to create 2 new Riddle objects

 

   // call their printQuestion() and printAnswer methods

 

  }

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions