IF im creating a HTML page how do I get java code to run on it, im trying to put a quiz on a website how would I do that, this is the code im trying to run. It runs on jGRASP how to I put it on a website?
import java.io.*;
import java.util.*;
public class StringLab2
{
public static Scanner input = new Scanner (System.in);
public static void main(String arg[]) throws IOException
{
int score = 0;
String key;
System.out.println("What is 100+1?");
System.out.println("A)101 B)ALOT!!");
key = input.next().toLowerCase();
if(key.equals("a"))
{
System.out.println("Correct");
score = score + 1;
}
else
if(key.equals("b"))
{
System.out.println("Wrong");
score = score - 1;
}
else
System.out.println("Is that an A or a B? Dont you know your alphabet?!");
score = score - 1;
System.out.println("What is the first letter of the alphabet?");
System.out.println("A, Z");
key = input.next().toLowerCase();
if(key.equals("a"))
{
System.out.println("Congralations you know your alphabet");
score = score + 1;
}
else
if(key.equals("b"))
{
System.out.println("NO thats the last letter smart guy!");
score = score - 1;
}
else
System.out.println("Seriously go back to kindergarden, then come back and try again!");
score = score - 1;
System.out.println("What is the last letter in the alphabet?");
System.out.println("Z, Hi");
key = input.next().toLowerCase();
if(key.equals("z"))
{
System.out.println("Wow, I bet you passed the first grade!!");
score = score + 1;
}
else
if(key.equals("Hi"))
{
System.out.println("REALLY?????????");
score = score - 1;
}
else
System.out.println("You should of payed more attention in preschool");
score = score - 1;
System.out.println("What is the 13th letter in the alphabet?");
key = input.next().toLowerCase();
if(key.equals("m"))
{
System.out.println("Wow you can count, and you know your alphabet your good!");
score = score + 1;
}
else
if(!key ==("m"))
{
System.out.println("You should try and learn to count, its not hard!");
score = score - 1;
}
}
}
import java.io.*;
import java.util.*;
public class StringLab2
{
public static Scanner input = new Scanner (System.in);
public static void main(String arg[]) throws IOException
{
int score = 0;
String key;
System.out.println("What is 100+1?");
System.out.println("A)101 B)ALOT!!");
key = input.next().toLowerCase();
if(key.equals("a"))
{
System.out.println("Correct");
score = score + 1;
}
else
if(key.equals("b"))
{
System.out.println("Wrong");
score = score - 1;
}
else
System.out.println("Is that an A or a B? Dont you know your alphabet?!");
score = score - 1;
System.out.println("What is the first letter of the alphabet?");
System.out.println("A, Z");
key = input.next().toLowerCase();
if(key.equals("a"))
{
System.out.println("Congralations you know your alphabet");
score = score + 1;
}
else
if(key.equals("b"))
{
System.out.println("NO thats the last letter smart guy!");
score = score - 1;
}
else
System.out.println("Seriously go back to kindergarden, then come back and try again!");
score = score - 1;
System.out.println("What is the last letter in the alphabet?");
System.out.println("Z, Hi");
key = input.next().toLowerCase();
if(key.equals("z"))
{
System.out.println("Wow, I bet you passed the first grade!!");
score = score + 1;
}
else
if(key.equals("Hi"))
{
System.out.println("REALLY?????????");
score = score - 1;
}
else
System.out.println("You should of payed more attention in preschool");
score = score - 1;
System.out.println("What is the 13th letter in the alphabet?");
key = input.next().toLowerCase();
if(key.equals("m"))
{
System.out.println("Wow you can count, and you know your alphabet your good!");
score = score + 1;
}
else
if(!key ==("m"))
{
System.out.println("You should try and learn to count, its not hard!");
score = score - 1;
}
}
}