Commit 30c0d799 authored by Gaurav Arora (gaa721)'s avatar Gaurav Arora (gaa721)
Browse files

Question Changing and Adding made easy and also added new way to answer

parent 6f7e9e95
......@@ -3,20 +3,30 @@ import java.util.ArrayList;
class Question implements Serializable
{
String type;
String question;
Rectangle answer;
String tAnswer;
public Question( String quest, Rectangle ans)
public Question(String type ,String quest, Rectangle ans)
{
this.type = type;
this.question = quest;
this.answer = ans;
}
public Question( String quest)
public Question( String type,String quest)
{
this.type = type;
this.question = quest;
}
public Question(String type ,String quest, String ans)
{
this.type = type;
this.question = quest;
this.tAnswer = ans;
}
//
// public Question(String quest)
// {
......
Question [][] questionandanswers = {
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(649.0, 299.0, 701.0, 342.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did blue tank bounce? If yes, then Mark the position where it bounced if no mark the blue tank. ", new Rectangle(207.0, 247.0, 278.0, 308.0))
}
,
{
new Question( "Text", "When you were not attentive, Blue tank rotated in som direction.Was it clockise,anticlockwise, or you are not sure?", "clockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance.", "Blue")
}
,
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(130.0, 116.0, 166.0, 150.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did blue tank bounce? If yes, then Mark the position where it bounced if no mark the blue tank. ", new Rectangle(352.0, 934.0, 417.0, 993.0))
}
,
{
new Question( "Text", "When you were not attnetivem Blue tank was rotated in some direction. Was it clockwise,anticlockwise or you are not sure.", "Anticlockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance.", "Green")
}
,
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(876.0, 390.0, 918.0, 433.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did green tank bounce? If yes, then Mark the position where it bounced if no, mark the green tank.", new Rectangle(7.0, 672.0, 65.0, 729.0))
}
,
{
new Question( "Text", "When you were not attentive green tank was rotated in some direction. Was it clockwise,anticlockwise or you are not sure.", "clockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance.", "Green")
}
,
{
new Question( "Text", "When you were not attentive Blue tank was rotated in some direction. Was it clockwise,anticlockwise or you are not sure.", "Anticlockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance. ", "Green")
}
,
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(120.0, 153.0, 164.0, 193.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did green tank bounce? If yes, then Mark the position where it bounced if no mark the green tank.", new Rectangle(541.0, 389.0, 614.0, 448.0))
}
,
{
new Question( "Text", "When you were not attentive Blue tank was rotated in some direction. Was it clockwise,anticlockwise or you are not sure. ", "anticlockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance.", "Green"),
}
,
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(903.0, 140.0, 935.0, 170.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did blue tank bounce? If yes, then Mark the position where it bounced if no mark the blue tank.", new Rectangle(531.0, 142.0, 610.0, 207.0))
}
};
......@@ -2,28 +2,27 @@ import java.util.Arrays;
import java.io.*;
public class Rectangle implements Serializable {
public class Points implements Serializable {
public class Point implements Serializable {
/*
* This is a 2D point with coordinate (x,y)
*/
double x;
double y;
Points() {
Point() {
this.x = 0;
this.y = 0;
}
Points(double x, double y) {
Point(double x, double y) {
this.x = x;
this.y = y;
}
public String show() {
return "( " + x + " , " + y + " )";
}
return x + " , " + y ; }
public boolean isEqual(Points p) {
public boolean isEqual(Point p) {
return this.x == p.x && this.y == p.y;
}
}
......@@ -31,19 +30,19 @@ public class Rectangle implements Serializable {
/**
* Rectangle is constructed by any two corner points p1 and p2
*/
Points p1, p2;
Point p1, p2;
public Rectangle() {
this.p1 = new Points();
this.p2 = new Points();
this.p1 = new Point();
this.p2 = new Point();
}
public Rectangle(double x1, double y1, double x2, double y2) {
this.p1 = new Points(x1, y1);
this.p2 = new Points(x2, y2);
this.p1 = new Point(x1, y1);
this.p2 = new Point(x2, y2);
}
public Rectangle(Points p1, Points p2) {
public Rectangle(Point p1, Point p2) {
this.p1 = p1;
this.p2 = p2;
}
......
......@@ -5,9 +5,9 @@
* designer and care should be taken when editing this file.
* Only add/edit code inside the event handlers i.e. only
* use lines between the matching comment tags. e.g.
void myBtnEvents(GButton button) { //_CODE_:button1:12356:
// It is safe to enter your event code here
// It is safe to enter your event code here
} //_CODE_:button1:12356:
* Do not rename this tab!
......@@ -15,11 +15,36 @@
*/
public void textfield1_change1(GTextField source, GEvent event) { //_CODE_:textfield1:215102:
println("textfield1 - GTextField >> GEvent." + event + " @ " + millis());
// println("textfield1 - GTextField >> GEvent." + event + " @ " + p.Ecounter);
if (event == GEvent.ENTERED)
{
print(source.getText());
participationID = source.getText();
folderName = "c:/Users/" + user + "/Desktop/gameStudyData/"+day()+"-"+month()+"-"+year()+"-"+ hour()+"-"+minute() +"-"+second()+ "-" +millis() +"-"+ participationID;
File file = new File(folderName);
file.mkdirs();
try
{
//writer = new PrintWriter("c:/Users/gaa721/Desktop/" + day()+"-"+month()+"-"+year()+"-"+ hour()+"-"+minute() +"-"+second()+ "-" + participationID + ".txt");
writer = new PrintWriter(new FileWriter(folderName+ "/"+day()+"-"+month()+"-"+year()+"-"+ hour()+"-"+minute() +"-"+second()+ "-" + participationID + ".txt"), true);
}
catch(FileNotFoundException e)
{
print(e.toString());
}
catch(IOException e)
{
print(e.toString());
}
startMenu =false;
label1.setVisible(false);
textfield1.setVisible(false);
......@@ -27,15 +52,65 @@ public void textfield1_change1(GTextField source, GEvent event) { //_CODE_:textf
}
} //_CODE_:textfield1:215102:
public void button1_click1(GButton source, GEvent event) { //_CODE_:button1:983045:
println("button1 - GButton >> GEvent." + event + " @ " + millis());
// tempFiler = (char)((int)(tempFiler-1);
tempFiler++;
if(tempFiler>'J')
{
source.setVisible(false);
noLoop();
text("Thanks",200,200);
}
else
setupInside();
source.setVisible(false);
//
// loop();
} //_CODE_:button1:983045:
public void textfield2_change1(GTextField source, GEvent event) { //_CODE_:questionToBeSaved:568734:
println("question - GTextField >> GEvent." + event + " @ " + millis());
if (event == GEvent.ENTERED)
{
tempQuestion = source.getText();
source.setVisible(false);
}
} //_CODE_:questionToBeSaved:568734:
public void textfield2_change2(GTextField source, GEvent event) { //_CODE_:QuestionType:844807:
println("QuestionType - GTextField >> GEvent." + event + " @ " + millis());
if (event == GEvent.ENTERED)
{
tempType = source.getText();
source.setVisible(false);
loop();
}
} //_CODE_:QuestionType:844807:
public void textfield2_change3(GTextField source, GEvent event) { //_CODE_:textfield2:870671:
println("textfield2 - GTextField >> GEvent." + event + " @ " + millis());
} //_CODE_:textfield2:870671:
// Create all the GUI controls.
// autogenerated do not edit
public void createGUI() {
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setCursor(ARROW);
if (frame != null)
if(frame != null)
frame.setTitle("Sketch Window");
label1 = new GLabel(this, 63, 195, 122, 24);
label1.setText("Enter Participation ID:");
......@@ -43,10 +118,26 @@ public void createGUI() {
textfield1 = new GTextField(this, 189, 197, 107, 23, G4P.SCROLLBARS_NONE);
textfield1.setOpaque(true);
textfield1.addEventHandler(this, "textfield1_change1");
button1 = new GButton(this, 298, 285, 122, 30);
button1.setText("Click for next drawing");
button1.addEventHandler(this, "button1_click1");
questionToBeSaved = new GTextField(this, 300, 493, 638, 72, G4P.SCROLLBARS_NONE);
questionToBeSaved.setOpaque(true);
questionToBeSaved.addEventHandler(this, "textfield2_change1");
QuestionType = new GTextField(this, 98, 502, 174, 56, G4P.SCROLLBARS_NONE);
QuestionType.setOpaque(true);
QuestionType.addEventHandler(this, "textfield2_change2");
textfield2 = new GTextField(this, 354, 637, 311, 29, G4P.SCROLLBARS_NONE);
textfield2.setOpaque(true);
textfield2.addEventHandler(this, "textfield2_change3");
}
// Variable declarations
// autogenerated do not edit
GLabel label1;
GTextField textfield1;
GButton button1;
GTextField questionToBeSaved;
GTextField QuestionType;
GTextField textfield2;
......@@ -3,20 +3,30 @@ import java.util.ArrayList;
class Question implements Serializable
{
String type;
String question;
Rectangle answer;
String tAnswer;
public Question( String quest, Rectangle ans)
public Question(String type ,String quest, Rectangle ans)
{
this.type = type;
this.question = quest;
this.answer = ans;
}
public Question( String quest)
public Question( String type,String quest)
{
this.type = type;
this.question = quest;
}
public Question(String type ,String quest, String ans)
{
this.type = type;
this.question = quest;
this.tAnswer = ans;
}
//
// public Question(String quest)
// {
......
Question [][] questionandanswers = {
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(649.0, 299.0, 701.0, 342.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did blue tank bounce? If yes, then Mark the position where it bounced if no mark the blue tank. ", new Rectangle(207.0, 247.0, 278.0, 308.0))
}
,
{
new Question( "Text", "When you were not attentive, Blue tank rotated in som direction.Was it clockise,anticlockwise, or you are not sure?", "clockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance.", "Blue")
}
,
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(130.0, 116.0, 166.0, 150.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did blue tank bounce? If yes, then Mark the position where it bounced if no mark the blue tank. ", new Rectangle(352.0, 934.0, 417.0, 993.0))
}
,
{
new Question( "Text", "When you were not attnetivem Blue tank was rotated in some direction. Was it clockwise,anticlockwise or you are not sure.", "Anticlockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance.", "Green")
}
,
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(876.0, 390.0, 918.0, 433.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did green tank bounce? If yes, then Mark the position where it bounced if no, mark the green tank.", new Rectangle(7.0, 672.0, 65.0, 729.0))
}
,
{
new Question( "Text", "When you were not attentive green tank was rotated in some direction. Was it clockwise,anticlockwise or you are not sure.", "clockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance.", "Green")
}
,
{
new Question( "Text", "When you were not attentive Blue tank was rotated in some direction. Was it clockwise,anticlockwise or you are not sure.", "Anticlockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance. ", "Green")
}
,
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(120.0, 153.0, 164.0, 193.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did green tank bounce? If yes, then Mark the position where it bounced if no mark the green tank.", new Rectangle(541.0, 389.0, 614.0, 448.0))
}
,
{
new Question( "Text", "When you were not attentive Blue tank was rotated in some direction. Was it clockwise,anticlockwise or you are not sure. ", "anticlockwise"),
new Question( "Text", "When you were not attentive both the tanks were moved. Which of the tank travelled more distance.", "Green"),
}
,
{
new Question( "Rectangle", "When you were not attentive tanks were moved. Mark the initial position of the green tank.", new Rectangle(903.0, 140.0, 935.0, 170.0)),
new Question( "Rectangle", "When you were non attentive tanks were moved. Did blue tank bounce? If yes, then Mark the position where it bounced if no mark the blue tank.", new Rectangle(531.0, 142.0, 610.0, 207.0))
}
};
......@@ -2,28 +2,27 @@ import java.util.Arrays;
import java.io.*;
public class Rectangle implements Serializable {
public class Points implements Serializable {
public class Point implements Serializable {
/*
* This is a 2D point with coordinate (x,y)
*/
double x;
double y;
Points() {
Point() {
this.x = 0;
this.y = 0;
}
Points(double x, double y) {
Point(double x, double y) {
this.x = x;
this.y = y;
}
public String show() {
return "( " + x + " , " + y + " )";
}
return x + " , " + y ; }
public boolean isEqual(Points p) {
public boolean isEqual(Point p) {
return this.x == p.x && this.y == p.y;
}
}
......@@ -31,19 +30,19 @@ public class Rectangle implements Serializable {
/**
* Rectangle is constructed by any two corner points p1 and p2
*/
Points p1, p2;
Point p1, p2;
public Rectangle() {
this.p1 = new Points();
this.p2 = new Points();
this.p1 = new Point();
this.p2 = new Point();
}
public Rectangle(double x1, double y1, double x2, double y2) {
this.p1 = new Points(x1, y1);
this.p2 = new Points(x2, y2);
this.p1 = new Point(x1, y1);
this.p2 = new Point(x2, y2);
}
public Rectangle(Points p1, Points p2) {
public Rectangle(Point p1, Point p2) {
this.p1 = p1;
this.p2 = p2;
}
......
......@@ -5,9 +5,9 @@
* designer and care should be taken when editing this file.
* Only add/edit code inside the event handlers i.e. only
* use lines between the matching comment tags. e.g.
void myBtnEvents(GButton button) { //_CODE_:button1:12356:
// It is safe to enter your event code here
// It is safe to enter your event code here
} //_CODE_:button1:12356:
* Do not rename this tab!
......@@ -15,11 +15,36 @@
*/
public void textfield1_change1(GTextField source, GEvent event) { //_CODE_:textfield1:215102:
println("textfield1 - GTextField >> GEvent." + event + " @ " + millis());
// println("textfield1 - GTextField >> GEvent." + event + " @ " + p.Ecounter);
if (event == GEvent.ENTERED)
{
print(source.getText());
participationID = source.getText();
folderName = "c:/Users/" + user + "/Desktop/gameStudyData/"+day()+"-"+month()+"-"+year()+"-"+ hour()+"-"+minute() +"-"+second()+ "-" +millis() +"-"+ participationID;
File file = new File(folderName);
file.mkdirs();
try
{
//writer = new PrintWriter("c:/Users/gaa721/Desktop/" + day()+"-"+month()+"-"+year()+"-"+ hour()+"-"+minute() +"-"+second()+ "-" + participationID + ".txt");
writer = new PrintWriter(new FileWriter(folderName+ "/"+day()+"-"+month()+"-"+year()+"-"+ hour()+"-"+minute() +"-"+second()+ "-" + participationID + ".txt"), true);
}
catch(FileNotFoundException e)
{
print(e.toString());
}
catch(IOException e)
{
print(e.toString());
}
startMenu =false;
label1.setVisible(false);
textfield1.setVisible(false);
......@@ -27,15 +52,65 @@ public void textfield1_change1(GTextField source, GEvent event) { //_CODE_:textf
}
} //_CODE_:textfield1:215102:
public void button1_click1(GButton source, GEvent event) { //_CODE_:button1:983045:
println("button1 - GButton >> GEvent." + event + " @ " + millis());
// tempFiler = (char)((int)(tempFiler-1);
tempFiler++;
if(tempFiler>'J')
{
source.setVisible(false);
noLoop();
text("Thanks",200,200);
}
else
setupInside();
source.setVisible(false);
//
// loop();
} //_CODE_:button1:983045:
public void textfield2_change1(GTextField source, GEvent event) { //_CODE_:questionToBeSaved:568734:
println("question - GTextField >> GEvent." + event + " @ " + millis());
if (event == GEvent.ENTERED)
{
tempQuestion = source.getText();
source.setVisible(false);
}
} //_CODE_:questionToBeSaved:568734:
public void textfield2_change2(GTextField source, GEvent event) { //_CODE_:QuestionType:844807:
println("QuestionType - GTextField >> GEvent." + event + " @ " + millis());
if (event == GEvent.ENTERED)
{
tempType = source.getText();
source.setVisible(false);
loop();
}
} //_CODE_:QuestionType:844807:
public void textfield2_change3(GTextField source, GEvent event) { //_CODE_:textfield2:870671:
println("textfield2 - GTextField >> GEvent." + event + " @ " + millis());
} //_CODE_:textfield2:870671:
// Create all the GUI controls.
// autogenerated do not edit
public void createGUI() {
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setCursor(ARROW);
if (frame != null)
if(frame != null)
frame.setTitle("Sketch Window");
label1 = new GLabel(this, 63, 195, 122, 24);
label1.setText("Enter Participation ID:");
......@@ -43,10 +118,26 @@ public void createGUI() {
textfield1 = new GTextField(this, 189, 197, 107, 23, G4P.SCROLLBARS_NONE);
textfield1.setOpaque(true);
textfield1.addEventHandler(this, "textfield1_change1");
button1 = new GButton(this, 298, 285, 122, 30);
button1.setText("Click for next drawing");
button1.addEventHandler(this, "button1_click1");
questionToBeSaved = new GTextField(this, 300, 493, 638, 72, G4P.SCROLLBARS_NONE);
questionToBeSaved.setOpaque(true);
questionToBeSaved.addEventHandler(this, "textfield2_change1");
QuestionType = new GTextField(this, 98, 502, 174, 56, G4P.SCROLLBARS_NONE);
QuestionType.setOpaque(true);
QuestionType.addEventHandler(this, "textfield2_change2");
textfield2 = new GTextField(this, 354, 637, 311, 29, G4P.SCROLLBARS_NONE);
textfield2.setOpaque(true);
textfield2.addEventHandler(this, "textfield2_change3");
}
// Variable declarations
// autogenerated do not edit
GLabel label1;
GTextField textfield1;
GButton button1;
GTextField questionToBeSaved;
GTextField QuestionType;
GTextField textfield2;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment