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

create a simple GUI flashcard program that reads data from a file. Instructions:

ID: 3571664 • Letter: C

Question

create a simple GUI flashcard program that reads data from a file.

Instructions:The goal of this project is to create a GUI flashcard program that reads data from a text file. It is expected that you will base your work on your previous projects. Create a data structure to hold a series of flashcard objects. For this project, read the data from a text file. It is recommended but not required to either have the data in CSV format or have the questions and answers on alternating lines. To select the file, use a JFileChooser as discussed in class examples. Also submit an example file of your questions and answers. There should be at least 5 questions and answers in the text file. When the program is launched the user should be presented with a JFileChooser which they will be use to select the data file to read. The GUI should consist of a single JLabel and JButton. On starting, the JLabel should display a welcome message and the JButton should display “Start.” After starting the first question should been displayed and the button should display “Click for Answer.” Upon the next click the label should display the answer and the button should display “Next Question.” After the last question has been answered the program should display a dialog box asking the user if they want to go through the questions again. The main button should be disabled. PLs Help..thank u..

Explanation / Answer

File Content

1) Who is current prime minister of India?
A) Narendra Modi

2) Who is the captain of India ODI Cricket Team?
A) Mahender Singh Dhoni

3) Who is the captain of India Test cricket team?
A) Virat Kohli

4) Who is the father of Computers?
A) Charles Babage

5) Who designed Java programming language ?
A) James Gossling

////////////////////////////////////////////////////////////////////////////////

package getHibernate.MyHibernate;

  
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextArea;

public class GUIFlashCardProgram extends JFrame{
  
   JFileChooser chooser=new JFileChooser();
   JTextArea textArea=new JTextArea();
   JButton starttest=new JButton("StartTest");
   JLabel label=new JLabel();
   public GUIFlashCardProgram() throws IOException,FileNotFoundException {
       super("GUI FlashCard Program");
       super.setLayout(new FlowLayout());
      
       super.add(chooser);
       super.setVisible(true);
       super.setSize(650,650);
       super.add(label);
       super.add(textArea);
  
       chooser.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent e) {
       System.out.println("Action"+e);

       }
       });
       int status = chooser.showOpenDialog(null);

   if (status == JFileChooser.APPROVE_OPTION) { //If file is loaded
  
   label.setText("Welcome to Quizzy");
   super.add(starttest);
   starttest.addActionListener(new ActionListener() {
          
           public void actionPerformed(ActionEvent e) {
              
               File selectedFile = chooser.getSelectedFile();
               try{
               BufferedReader reader=new BufferedReader(new FileReader(selectedFile));
           String line = null;
           while ((line = reader.readLine()) != null) {
           //System.out.println(line);
           textArea.append(line + " ");
           }
           reader.close();  
               }catch(Exception ex){
                   ex.fillInStackTrace();
               }
              
           }
       });
  
  
   } else if (status == JFileChooser.CANCEL_OPTION) { //Cancel button is clicked
   System.out.println("cancelled");
   System.exit(1);
   }
   }

   public static void main(String[] args) throws IOException,FileNotFoundException {
      
      
       new GUIFlashCardProgram();

   }

}

I am running out of time. With this you may get some clue. Try it. All the Best. Cheggg!!!