Below is 2 java FX code for an online Assessment system one is mytest.java and the other is result .java, so basically t

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Below is 2 java FX code for an online Assessment system one is mytest.java and the other is result .java, so basically t

Post by answerhappygod »

Below is 2 java FX code for an online Assessment system one ismytest.java and the other is result .java, so basically the codeare to generate entry form, login form, question form andresult form.
for the result form i need to get the assessment data frommytest.java to generate the result. (exam_answer.txt,question.txt)
Provide the code for result.java so that i get theinformation from mytest.java to display the result with thepercentage.
below result.java needs to edited
public class MyTest extends Application {
private File myf = new File("./data","questions.txt"); private File answers = newFile("./data","exam_answers.txt"); private int totQues = 0; private int activeQ = 1; private String selectedAns, fullAns;
private Pane mainPane; private Pane paneC; private Scene mainScene; private MyGreeting winGreeting; private MyFarewell winFarewell; private LinkedList<Question> quesList = newLinkedList<Question>(); private LinkedList<Applicant> appList = newLinkedList<Applicant>(); private Result winResult;
Result.java
import java.io.File;import java.io.FileNotFoundException;import java.io.IOException;import java.io.RandomAccessFile;import java.util.ArrayList;import java.util.LinkedList;import java.util.List;import java.util.Scanner;import javafx.collections.FXCollections;import javafx.geometry.Pos;import javafx.scene.Scene;import javafx.scene.control.*;import javafx.scene.layout.*;import javafx.scene.shape.Line;import javafx.stage.Stage;import javafx.scene.control.TextField;import javafx.collections.ObservableList;import javafx.scene.control.Button;import javafx.scene.control.Label;import javafx.scene.control.ComboBox;import javafx.scene.layout.Pane;import javafx.scene.paint.Color;import javafx.scene.text.Font;import javafx.scene.text.FontWeight;import javafx.scene.shape.*;import javafx.scene.image.*;
public class Result extends Stage {
private Label labResultTitle, labUName, labAge,labGender, labNationality;//labels for result page private Lineframe1,frame2,frame3,frame4,frame5,frame6,frame7,frame8; private Pane resultForm; private ImageView imgLogo1,imgLogo2; private TextField age, gender,nationality; private static int REC_SIZE = 44; private static int NAME_SIZE = 10; private LinkedList<Applicant> appList = newLinkedList<Applicant>(); private RandomAccessFile raf; private File answers = newFile("./data","exam_answers.txt"); private int currentID; private ComboBox comboBox; private String selectedName; private Button btnEnd;
private File qfile = new File("./data", "questions.txt"); private int totQues = 30; private Label labGrade; private Label labResult, labPercentage; private char cAns; private char ansSheet[] = new char[totQues]; private char finalAns[] = new char[totQues];
public Result() throws IOException { this.setTitle("Result Form"); //Setting up components //initialization of the applicantslists raf = newRandomAccessFile("data/applicants.txt", "rw"); initAppList(raf); //just the black lines foraesthetics frame1 = new Line(); frame1.setStartX(50.0); frame1.setStartY(125.0); frame1.setEndX(550.0); frame1.setEndY(125.0); frame2 = new Line(); frame2.setStartX(50.0); frame2.setStartY(125.0); frame2.setEndX(50.0); frame2.setEndY(450.0); frame3 = new Line(); frame3.setStartX(50.0); frame3.setStartY(450.0); frame3.setEndX(550.0); frame3.setEndY(450.0); frame4 = new Line(); frame4.setStartX(550.0); frame4.setStartY(125.0); frame4.setEndX(550.0); frame4.setEndY(450.0); frame5 = new Line(); frame5.setStartX(50.0); frame5.setStartY(125.0); frame5.setEndX(550.0); frame5.setEndY(125.0); frame6 = new Line(); frame6.setStartX(50.0); frame6.setStartY(125.0); frame6.setEndX(50.0); frame6.setEndY(450.0); frame7 = new Line(); frame7.setStartX(50.0); frame7.setStartY(450.0); frame7.setEndX(550.0); frame7.setEndY(450.0); frame8 = new Line(); frame8.setStartX(550.0); frame8.setStartY(125.0); frame8.setEndX(550.0); frame8.setEndY(450.0); //contents on the result page Image imageLogo = new Image(newFileInputStream("data/logo.png")); imgLogo1 = newImageView(imageLogo); imgLogo1.setPreserveRatio(true); imgLogo1.setLayoutX(175); imgLogo1.setLayoutY(10); imgLogo1.setFitWidth(250); imgLogo2 = newImageView(imageLogo); imgLogo2.setPreserveRatio(true); imgLogo2.setLayoutX(175); imgLogo2.setLayoutY(10); imgLogo2.setFitWidth(250); labResultTitle = new Label("RESULTPAGE"); labResultTitle.setLayoutX(210); labResultTitle.setLayoutY(75); labResultTitle.setFont(Font.font("OpenSans", FontWeight.BOLD, 28)); labResultTitle.setTextFill(Color.color(0.67, 0.05, 0.05));
labUName = new Label("Username :"); labUName.setLayoutX(100); labUName.setLayoutY(150); labUName.setFont(Font.font("Open Sans",FontWeight.BOLD, 13));
ObservableList<String> options= FXCollections.observableArrayList( appList.get(0).getName(), appList.get(1).getName(), appList.get(2).getName(), appList.get(3).getName(), appList.get(4).getName(), appList.get(5).getName(), appList.get(6).getName(), appList.get(7).getName(), appList.get(8).getName(), appList.get(9).getName() ); comboBox = new ComboBox(options); comboBox.setLayoutX(260); comboBox.setLayoutY(150); comboBox.setStyle("-fx-base:white");
labAge = new Label("Age : "); labAge.setLayoutX(100); labAge.setLayoutY(200); labAge.setFont(Font.font("Open Sans",FontWeight.BOLD, 13));
age = new TextField(); age.setLayoutX(260); age.setLayoutY(200); labGender = new Label("Gender :"); labGender.setLayoutX(100); labGender.setLayoutY(250); labGender.setFont(Font.font("OpenSans", FontWeight.BOLD, 13)); gender = new TextField(); gender.setLayoutX(260); gender.setLayoutY(250); labNationality = new Label("Nationality: "); labNationality.setLayoutX(100); labNationality.setLayoutY(300); labNationality.setFont(Font.font("OpenSans", FontWeight.BOLD, 13)); nationality = new TextField(); nationality.setLayoutX(260); nationality.setLayoutY(300);
// Show "Results" labResult = new Label();
// Show Percentage Label percentage = newLabel("PERCENTAGE: ");
labPercentage = new Label();
labGrade = new Label();
Label selected = new Label();
// Button Proceed to end btnEnd = new Button("End"); btnEnd.setLayoutX(500); btnEnd.setLayoutY(400); }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply