I am finding this program hard to run on Java app, pls check for me: public static
Question:
I am finding this program hard to run on Java app, pls check for me: public static int checkEntry(int number)/*method argument we use integer because the value of entry is integer*/ { int numval=number; /*store the value into numval variable*/ if (numval<35 && numval>1)/*first conditional statement if number less than 35 but not equal to 1*/ { numval=numval*5;/*if statement above is true the perform the operation set the new value of numval*/
} else if (numval>=35)/*first conditional statement if number greater than or equal to 35*/ { numval=numval+10;/*if statement above is true the perform the operation set the new value of numval*/
} return numval;/*this will return the value of numval in this method*/ } public static void main(String args[]) { Scanner var=new Scanner(System.in);/*for Scanner*/ System.out.println("***If you wish to exit the program please enter 1***");/*To display first our instruction*/ while (true)/*A while loop condition if the Boolean value is always false the loop will continue*/ { System.out.print("Please Input the Digits between 5 and 45: ");/*if bool1==false then display the instruction to input digits*/ int num=var.nextInt();/*get the value of number entered by user and store it in the num variable which data type is integer and use nextInt instead of nextline*/
if(num==1)/*check the entry if the user enter a number 1 then the loop will break and program will exit*/ { System.out.print("Program Exit...");/*Exit message*/ break;/*it will break the while loop*/ }
/*if the entry is not equal to 1 then the system will proceed here*/
System.out.print("Result: ");/*displa message for result*/ System.out.println(checkEntry(num));/*call the checkEntry method to validate the number entry by the user and display the result here*/
/*since the system not break the boolean value will be always a false and looping will stil continue*/
} } }
Corporate Finance
ISBN: 9781265533199
13th International Edition
Authors: Stephen Ross, Randolph Westerfield, Jeffrey Jaffe