Ajp Microproject
Ajp Microproject
On
“Quiz Application”
Subject :- Advanced Java Programming (22517)
Submitted By
Anushka Chimalwar Isha Kshirsagar
Krupa Urade Pihu Sonwane
Sachin Ade Yash Punekar
Guided By :-
MISS. P. Singh Mam
Anushka Chimalwar…………………………………………………
Isha Kshirsagar………………………………………………………
Krupa Urade…………………………………………………………
Pihu Sonwane……………………………………………………….
Sachin Ade……………………………………………………………
Yash Punekar…………………………………………………………
Guided By
MISS. P. Singh Mam
HOD Name
MISS. P. Singh Mam
INDEX
ABSTRACT
The calculator is an application to calculate the values of two numbers and
helps to solve numerical equations. The system would provide basic equation
like add/sub/div/multiply the numerical equations, and manage check in
specifications for the systems based on the user's input of need.
It allows the user to calculate the numbers and helps to solve the sums and
mathematical equations. This software allows addition, subtraction, division and
multiplication It helps to calculate the values and also to solve the numerical
sums/equations. The implementation of this system will provide the options of
(+,-, *) to calculate numerical sums.
CODING
import java.awt.*;
import java.awt.event."
import javax.swing.*:
public class QuizGame3 extends JFrame implements ActionListener {
JLabel lolQuestion;
JRadioButton rbOpt1, rbOpt2, rbOpt3, rbOpt4;
ButtonGroup bg.
JButton btnNext,
int current = 0, score = 0
String[][] questions = {
{"What is the superclass of all classes in Java?",
"Object", "Class", "String", "Integer"). "Which statement is used to define a
class in Java?", {
"Class", "Method", "Inheritance", "Object").
{"What is the keyword used to create a subclass in Java?", "Extends",
"Subclass", "Inheritance", "Parent").
{"Which keyword is used to overload a method in java?", "Overload",
"Override", "Super", "This").
{"Which keyword is used to access the members of a class?".
"This", "Super", "Overload", "Override"},
{"What is the keyword used to refer to a member of the superclass?", "Super",
"Parent", "Child", "Class"}, {"Which keyword is used to create an interface in
Java?",
"Interface", "Class", "Extends", "Implements"},
{"Which keyword is used to prevent a class from being inherited?", "Final",
"Static", "Private", "Protected"). {"Which keyword is used to define a method
that can be overridden?",
"Virtual", "Abstract", "Final", "Override"). {"Which keyword is used to refer to
the current class instance?", "This", "Super", "Child", "Parent"}
}:
public QuizGame3() {
super("Java Quiz Game");
lblQuestion new JLabel();
rbOpt1= new JRadioButton():
rbOpt2= new JRadioButton().
rbOpt3= new JRadioButton(): rbOp14= new JRadioButton():
bg=new ButtonGroup();
btnNext = new JButton("Next Question");
btnNext.addActionListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE):
setLayout(new FlowLayout(FlowLayout CENTER, 10, 10));
add(lblQuestion);
add(rbOpt1);
add(rbOpt2);
add(rbOpt3); add(rbOpt4);
add(btnNext);
bg.add(rbOpt1);
bg add(rbOpt2), bg.add(rbOpt3);
bg add(rbOpt4);
setSize(400, 400).
setVisible(true);
ask Question();
}
public void askQuestion() {
IblQuestion setText(questions[current][0]): rbOpt1 setText(questions [current]
[1]).
rbOpt2 setText(questions[current][2]).
rbOpt3.setText(questions[current][3]);
rbOpt4.setText(questions[current][4]);
}
public void actionPerformed(ActionEvent e) {
if (rbOpt1.isSelected() || rbOpt2.isSelected() || rbOpt3.1sSelected()
rbOpt4.is Selected()) {
if (rbOpt1 isSelected()) { if (questions[current] [1] equals("Object")
|| questions[current][1].equals("Class")
|| questions[current][1] equals("Extends") || questions[current]
[1].equals("Overload")
|| questions[current][1].equals("This") || questions[current] [1] .equals("Super")
|| questions [current][1].equals("Interface") | questions[current]
[1].equals("Final") || questions[current][1].equals("Virtual")
|| questions[current][1].equals("Abstract")) {
score++;
}
if (rbOpt2.isSelected()) {
if (questions[current][2].equals("Object")
|| questions[current][2].equals("Class") || questions[current][2]
equals("Extends") || questions[current] [2] equals("Overload") ||
questions[current][2].equals("This") || questions[current][2].equals("Super") ||
questions[current][2].equals("Virtual")
|| questions[current][2].equals("Interface") || questions[current]
[2].equals("Final")
|| questions[current][2].equals("Abstract")) {
score++
}
if (rbOpt3.isSelected()) {
if (questions[current] [3] equals("Object") || questions[current]
[3] .equals("Class")
|| questions [current][3].equals("Extends")
|| questions [current][3].equals("Overload")
|| questions[current][3].equals("This")
|| questions[current][3].equals("Super")
|| questions[current][3].equals("Interface") || questions[current]
[3].equals("Final")
|| questions[current][3].equals("Virtual")
|| questions[current][3].equals("Abstract")) {
score++;
}
}
if (rbOpt4.isSelected()) {
if (questions[current] [4] equals("Object")
|| questions[current][4].equals("Class")
|| questions[current][4] equals("Extends")
|| questions[current][4].equals("Overload")
|| questions [current][4].equals("This") || questions[current][4].equals("Super")
|| questions[current][4] equals("Interface")
|| questions[current][4].equals("Final")
|| questions [current][4].equals("Virtual") || questions[current]
[4].equals("Abstract")) {
score++:
}
} current++;
if (current >= questions.length)
{
btnNext.setEnabled(false);
JOptionPane.showMessageDialog(this. "Your final score is " + score):
System.exit(0):
)else ( askQuestion():
}
else
{
JOptionPane showMessageDialog(this, "Please select an option!"); }
}
public static void main(String[] args) {
new QuizGame3();
}
OUTPUT
SOFTWARE REQUIREMENTS
Notepad
JAVA (jdk)
Command Prompt
CONCLUSION
The Calculator allows the user to calculate the numbers and helps to solve the
sums and mathematical equations. This software allows addition, subtraction,
division and multiplication It helps to calculate the values and also to solve the
numerical sums/equations. The implementation of this system will provide the
options of (+,-, /.*) to calculate numerical sums.
REFERENCE
www.google.com
www.geeksforgeeks.com
www.javapoint.com
www.github.com