Hello! Evryone im not really good at java programming so i hope you dont mind with some silly questions!
So i have to create a java code which imitates dice rollings till rolls up 1 or 6 when comes 1 or 6 the game stops and counts everything togeather. So here is my idea how to create a code but it isnt working well, especially part when have to count everything!
Thanks everyone!
import java.util.Random; //java iebuvets nejausi izveletu skaitlju generators
class kaulins {
public static void main (String[] args) {
Random kaulinss = new Random();
int skaitlis;
System.out.println("Speles noteikumi - Jus metat kaulinju tik ilgi lidz uzmetat");
System.out.println("viens vai sesi, kad ir uzmests kads no siem skaitliem spele");
System.out.println("beidzas un jus iegustat savu rezultatu, jo lielaks rezultats");
System.out.println("jo labak jums!");
System.out.println("Lai spele sakas!!!");
for(int counter=1; counter<=20; counter++){
skaitlis = 1+kaulinss.nextInt(6);
System.out.println(skaitlis+" - metiena rezultats");
if (skaitlis == 6)
System.exit(0);
else
System.out.println("");
if (skaitlis == 1)
System.exit(0);
else
System.out.println ("");
String sum;
System.out.println(sum = skaitlis+skaitlis+"Rezultats kopaa!");
}
}
}
class rezultats extends kaulins {
public static void main(String[] args) {
String sum;
System.out.println(sum = skaitlis+skaitlis + "Rezultats kopaa!");
}
}