Question
Language is JAVA Create a JFrame with a JPanel containing the following components: JLabel for displaying the program session number, question number and questions JTextField
Language is JAVA
Create a JFrame with a JPanel containing the following components: JLabel for displaying the program session number, question number and questions JTextField for the user's response to be typed
JButtons for the user to do the following:
Start the session
Proceed to the next question
Finish the session and start a new one
Display the log file of all sessions recorded in the file
Display a list containing the longest word from each answer line in the file
Display a sorted list containing the longest word from each answer line in the file
JTextArea to display the content, but not allow the user to modify the displayed content
JScrollPane so the user can scroll through the entire log or list being displayed
JTextArea to display the content, but not allow the user to modify the displayed content
JScrollPane so the user can scroll through the entire log or list being displayed
public class QuestionBank {
String [] questions;
int currQuestionIndex;
public QuestionBank(){
questions = new String [10]; //increase array size if you will add more questions
questions[0]= "Which three words describe you best?";
questions[1]= "Which is your best feature?";
questions[2]= "Which common saying or phrase describes you?";
questions[3]= "Whats the best thing thats happened to you this week?";
questions[4]= "Who was your role model when you were a child?";
questions[5]= "Who was your favorite teacher and why?";
questions[6]= "What was your favorite subject at school?";
questions[7]= "What did you want to be when you grew up?";
questions[8]= "If you could have one wish come true what would it be?";
questions[9]= "Which would you prefer three wishes over five years or one wish right now?";
//add more questions
}
public String getNextQuestion() {
//do stuff in here to get the next question.. Randomly from the array...
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started