Jesus Doe

Greenhorn
+ Follow
since Apr 14, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jesus Doe

So, if i had a form to submit a username... using maxInterval.. and I submited to a page that would then link to a page and dispaly the name...once i reach the time out the username would become null... but by simply refreshing the name would become accessible again and for maxAge on refresh i would still not be able to access the username once the max life had been reach unless i go back to enter the username.
I think I may be incorrect in my thinking...
16 years ago
JSP
Hi,
I was wondering if someone could explain the differance between both of these. I would like to know how each works.
-Thanks
16 years ago
JSP
I compile my program and its goes fine, when trying to display the last system.out.print I instead get and error message any help?

Enter an integer value:3
3 is positive, odd and small
Enter a double value:3.456
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:819)
at java.util.Scanner.next(Scanner.java:1431)
at java.util.Scanner.nextInt(Scanner.java:2040)
at java.util.Scanner.nextInt(Scanner.java:2000)
at HW1_fabian.main(HW1_fabian.java:45)
Press any key to continue . . .


//Jesus Fabian
//CIN 220039753


import java.util.Scanner;

public class HW1_fabian
{
public static void main(String args[])
{

int x;
double round;
Scanner input=new Scanner(System.in);

System.out.print("Enter an integer value:");
x=input.nextInt();
{
if
(x>0)
System.out.printf("%d is positive, ", x);
if
(x<0)
System.out.printf("%d is negative, ", x);
if
(x==0)
System.out.printf("%d is neutral,\n", x);
{
if
(x%2 == 0)
System.out.print("even");
else
System.out.print("odd");
}
if
(x>1000)
System.out.print(" and big\n");
if
(x>=1 && x<1000)
System.out.print(" and small\n");
}


System.out.print("Enter a double value:");
round=input.nextInt();

//am only doing this to see if something simple would work, but i keep getting the same error
System.out.print(round);
17 years ago
I wish to learn how to round double varaibles without using math.round(); I have a rough idea of what might work but have been unable to execute it or get it set up right.I was thinking of maybe have the input divide by 1 but only retaning the remainder, and then comparing the remainder with .49 and .50 and depending on which one is true lets say the remainder is less than or equal to .49 then i would only ask to print the int of lets say num1 and then if the remainder is greater than or equal to .50 then to num1 add 1. I dunno Help?
17 years ago