package ovn; import java.util.*; import javagently.LasIn; public class HeikuraM_RO1_3 { public static void main(String[] args){ title("Guess the Number!"); Random generator=new Random(); System.out.println("This program lets you guess a number that the computer" + "randomly chose, from an interval that you choose. It also counts " + "your score. :)"); boolean success=false; while(success==false){ int lowerBound=LasIn.läsHeltal("Enter the lower bound. "); int upperBound=LasIn.läsHeltal("Now enter the upper bound. "); if(lowerBound>upperBound){ System.out.println("The lower bound cannot be higher than the upper"+ "bound, silly!"); } else{ success=true; } } int compChoise = generator.nextInt(upperBound - lowerBound + 1 ) + lowerBound; int guess=LasIn.läsHeltal("Do you think you're lucky? Take a guess!"); if(guess==compChoise){ System.out.println("You are correct! You got it right in "); } else if(guesscompChoise){ System.out.println("Lower..."); } else { System.out.println(""); } } } public static void title(String title){ int i=title.length(); // Prints the title. while(i>0){ System.out.print("*"); i--; } System.out.println("\n"+title); i=title.length(); while(i>0){ System.out.print("*"); i--; } System.out.println(); } }