Skip to content

Instantly share code, notes, and snippets.

Created March 28, 2013 12:06
Show Gist options
  • Save anonymous/5262646 to your computer and use it in GitHub Desktop.
Save anonymous/5262646 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
class dreizehn4
{
public static void main (String[] args)
{
Scanner in=new Scanner(System.in);
int str=42,life=42,luck=42;
String name;
boolean a=false;
System.out.println("Input name!");
name=in.nextLine();
while(a==false)
{
System.out.println("Input strenght (Int 1-10). Sum of strenght, life and luck may not exceed 15.");
str=in.nextInt();
if(str>=1 && str<=10)
{
a=true;
}
}
a=false;
while(a==false)
{
System.out.println("Input life (Int 1-10). Sum of strenght, life and luck may not exceed 15.");
life=in.nextInt();
if(life>=1 && life<=10)
{
a=true;
}
}
a=false;
while(a==false)
{
System.out.println("Input luck (Int 1-10). Sum of strenght, life and luck may not exceed 15.");
luck=in.nextInt();
if(luck>=1 && luck<=10)
{
a=true;
}
}
if(str+life+luck>15)
{
System.out.println();
System.out.println("You assigned too many points!");
str=5;
life=5;
luck=5;
}
System.out.println();
System.out.println(name+": "+"strenght: "+str+", life: "+life+", luck: "+luck);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment