I am making a lottery program where I am asking if basically they would like a quick pick ticket. The numbers for their ticket of course would be random since ...
import java.util.Scanner;
class Practice {
public static void main(String args[]) {
System.out.println("Enter the number of treats you have:");
Scanner treatsScanner = new Scanner(System.in);
int ...
Simply stating "I get a big time error" doesn't really help us help you. WHAT exactly is the error? Is it when you try to compile or when you run it? If it's a compiler error, what is the exact text of the error? If it's during run-time, what exactly is it doing wrong - what do you expect to happen, ...
Hello, I'm trying to write a method that will accept three integers as parameters and return true if one of the integers is the midpoint between the other two integers, and order does not matter. I'd appreciate some help on how I should use boolean statements in this; would I just have an if/else statement for each possible situation? ie. if((a+b)/2 ...
Basically I am very new too java, I am an adult student and have been trying to understand return statements and Boolean expressions (used separately or together). The resources that I do have are just not clicking for me, so I was wondering if anyone could give me a crash course. Basically I under stand with Boolean the symbols such as ...
You should use a boolean or an enumated type for ***, not a String. That being said, compare strings with equals, not ==. You can also lose the extra parens -- && has lower priority, and you can also replace the if/then/else with something simpler. So [CODE] boolean bmiRange; if (g1="Male") && (bmi >= 19.1 && <= 25.8) { bmiRange=true } ...
Hey, I somewhere remember that if ... else ... can be written as booleanexpr?expr1true:expr2false ; but it doesn't work and the jvm gives " : expected as error" am i doing something wrong here? code : Vector lijst=new Vector(); for (int k=0;k