Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add code to both constructors. The code creates and array of references which is initialized to null when we use new. Then, we add objects

Add code to both constructors. The code creates and array of references which is
initialized to null when we use new. Then, we add objects or type
TrueFalseQuestion to the array. Type and undestand the comments inside the 2nd
constructor.
package lab2;
import java.util.Date;
public class TrueFalseQuiz
{
int currectQuestion;
TrueFalseQuestion [] trueFalseQuestions;
public TrueFalseQuiz()
{
trueFalseQuestions = new TrueFalseQuestion [5];
trueFalseQuestions [0]=
new TrueFalseQuestion("The Pacific Ocean is larger than the Atlantic Ocean",
true, new Date());
trueFalseQuestions [1]=
new TrueFalseQuestion("The Suez Canal connects the Red Sea and the Indian Ocean.",
false, new Date());
trueFalseQuestions [2]=
new TrueFalseQuestion("The source of the Nile River is in Egypt.",
false, new Date());
trueFalseQuestions [3]=
new TrueFalseQuestion("Lake Baikal is the world's oldest and deepest freshwater lake.",
true, new Date ());
trueFalseQuestions [4]=
new TrueFalseQuestion("The Amazon River is the longest river in the Americas.",
true, new Date());
this. currectQuestion =0;
}
public TrueFalseQuiz(String[] questions, boolean [] trueFalse )
{
//>create an array of REFERENCES of size questions. length
llthe references are intialized to null
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

Determine each indefinite integral. Ico cothx csch x dx

Answered: 1 week ago