Comment

please solve this and mail me at
Solve this problem,
January 25, 2010 at 2:28 AM

public class Lottery
{
public static long lotteryOdds(int high, int number)
{
long r=1;
int i;
for(i=1; i<=number; i++)
{
r=r * high / i;
high--;
}
return r;
}
public static void main(String[] args)
{
int numbers = Console.readInt("How many numbers do you want to draw?");
int topNumber = Console.readInt("What is highest number u can draw?");
long oddsAre =lotteryOdds(topNumber, numbers);
System.out.println("Your odds are 1 in " + oddsAre + "Good Luck!!!!!");
}
}
View All Comments | View Tutorial
Related Tutorial and Articles
Java Beginners

can interface solve this problem in java
can interface solve this problem in java  I have a JDialog which... this calander class. can interface solve this problem. If yes then how. pls.../tutorial/java/swing/datePicker.html   thanks very much 

Java Beginners

Solve
add the numbers and print the output  There will be 5 numbers (each in a new line) written in a text file. Text file name will be ?input2.txt?. Your Java code should read that text file, add all the numbers and print the output 

JSP Servlet Questions

solve this problem
solve this problem  I typed this program and compiled.The program is compiled but when i eneterd url in tomcat server. Its not giving error but only... in table please tell me the solution for thid problem import java.io.*; import 

Java Beginners

How to solve button problem - Java Beginners
to solve this problem. Thank you Sir, Yours truly, T.Ramesh Puttaparthy...How to solve button problem  I have created button (Open File Dialog... Open Dialog Box and from that displaying image files. But problem is I‚??ve used 

Java Beginners

help me to solve this problem..
help me to solve this problem..  Given below is a class definition for Book. Type and compile the class, and answer the following questions: class Book { String title; //book‚??s title double price; //book‚??s price 

JSP Servlet Questions

Solve this problem plzzz
Solve this problem plzzz  Prashant.jsp (this is my JSP file) <HTML> <HEAD> <TITLE>Login using jsp <BODY>... kindly help me and check all those files and solve my problem as soon as possible 

Java Beginners

how to solve an internet connection problem
how to solve an internet connection problem  when i run my application it give me this error: Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not yet implemented the problem is that i don`t know 

Java Beginners

how to solve this problem for oracle connectivity
how to solve this problem for oracle connectivity  Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap ter could not establish the connection 

PHP Questions

Please Help To Solve My Problem
Please Help To Solve My Problem  PHP I Have 6 Textbox and 1 ok... With B Team when A Team Play With B Team Again Then Generate Error. I Am Solve This Problem With If...Else If...Else Statement But When the More Team 

Java Beginners

how do i solve this problem?
how do i solve this problem?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access 

JavaScript Questions

i need help to solve this problem
i need help to solve this problem  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from standard input and prints them in reverse order. and Show step by step what queue will look like 

JSP Servlet Questions

Simple problem to solve - JSP-Servlet
Simple problem to solve  Respected Sir/Madam, I am R.Ragavendran.. Thanks for your kind and timely help for the program I have asked.... But in that I am facing a very very minute problem. The alert boxes are displayed 

JSP Servlet Questions

Simple problem to solve - JSP-Servlet
Simple problem to solve  Respected Sir/Madam, I am.... But in that I am facing a very very minute problem. The alert boxes are displayed.../Regards, R.Ragavendran..   Hi Raghavendran, The problem is not so 

Java Beginners

A Program To Solve In Java
A Program To Solve In Java  x!/x+(x+2)!/x+(x+4)!/x ... (x+n)!/x 

Java Beginners

Solve Program - Java Beginners
Solve Program  Write a progaram in java to display all odd number from 1 to 100   hi use this code package rajanikant.code.sep_2008...://www.roseindia.net/java/ Thanks 

Java Beginners

Solve it - Java Beginners
Solve it  Hi Friends, Thanks for continue reply.. I have... is write here. no information display in the jsp file please solve it and let me know This is java file public Vector getExamInfo() { String 

Java Beginners

solve it - Java Beginners
solve it  Hi friend, I want to use switch case in jsp please let me know how to call page in jsp using include tag i want call this file using include tag please help me use switch statement in jsp 

Java Beginners

to solve the error - Java Beginners
to solve the error  class bubbleSort1{ public static void bubbleSort(int[] x) { int n = x.length; for (int pass=1; pass < n; pass...; } } } } } For read more information : http://www.roseindia.net/java/ Thanks 

Java Beginners

please solve the programme
please solve the programme  Develop a java program to find the roots of a quadratic equation ax2+bx+c=0, with the following specification :- Class name :- Quad Data members float a,b,c,d, with a,b,c are the co-efficient 

Java Beginners

Solve it
Solve it  How to calculate the value which contains oparator and operand both using command line argument 

JavaScript Questions

plz solve my query?
plz solve my query?  how to remove all the options from select control in html using java script?   JavaScript remove all items <html> <script language="javascript" > function removeAllItems(selectbox 

Java Beginners

solve this
solve this   Create a student class. The student object should have studentid, studentname, subject and marks as properties. Also generate the getter and setter methods. Create 5 objects of this class and populate values 

Java Beginners

How to Solve the Syntax Error in java??
How to Solve the Syntax Error in java??  Syntax error in java? i have tried this program its showing error like this in Eclipse "Syntax error on token "i", VariableDeclarator expected after this token" . in last line 

Java Interview Questions

i dont no how to solve it pls
i dont no how to solve it pls   Calculate and display the sum of all prime number from 1 to 100 covert in java system codes 

Java Beginners

Java Problem - Java Beginners
, Code to solve the problem : import java.io.*; public class PrimeNumber...Java Problem  Write a program 2 input a positive integer n and check wheter n is prime or not and also know the position of that number in the prime 

Java Beginners

write a java program to solve the infix expression
write a java program to solve the infix expression  ==>> solve the below expression using java program: 2+5*2-5+6/2 using stack operations or any other process in java 

Java Beginners

Problem with picture - Java Beginners
Problem with picture   Hi, I Develope a School Automated System... He/She is trying to Update the details. Please solve this proble with Microsoft Database (MSSQL) Thanks Programmer. Please help to solve 

Java Beginners

Problem with picture - Java Beginners
Problem with picture   Hi, I Develope a School Automated System... He/She is trying to Update the details. Please solve this proble with Microsoft Database (MSSQL) Thanks Programmer. Please help to solve 

Java Beginners

problem
problem  Hi, what is java key words   Hi Friend, Java Keywords are the reserved words that are used by the java compiler for specific... information, visit the following link: Java Keywords Thanks 

Java Interview Questions

problem
problem  hi'sir mai niit student hu.mujhe java ka program samaj me nhi aata mai kya karu and mai kaise study karu please help me.   Learn Java from the given link: Java Tutorials 

Java Beginners

code problem - Java Beginners
java script j2ee j2me sql plz help me to sort out this problem. thnx   Hi Friend, Please try the following sample code to solve your problem...code problem  Dear sir, I'm havin a problem that suppose i've got 

Java Beginners

Check Digit Question not able to solve..
Check Digit Question not able to solve..   Hi, I need some help asap. I been stuck for this question for more than 3 days. Using Java. User needs to key in identification number (e.g. U0906931E) system check for the first 

Java Beginners

JAVA CLASSPATH PROBLEM
the classpath to solve the problem as i solved for previous project. but this time...JAVA CLASSPATH PROBLEM  hi all Friends I am stuck using the java servlets and problem raise for classpath. I had a problem with servlet to call 

Java Beginners

script problem - Java Beginners
is not working.plz solve this . Thank you 

Java Beginners

need to solve the below question - Java Beginners
need to solve the below question  I need to write an application that uses the circle class.it must read a radius of a circle from the user .create a circle object and return the object 

Java Interview Questions

plz solve this program - Java Interview Questions
plz solve this program  write a program to out put this resault using two dimensional array this is an image of the reasult: http://www.4shared.com/file/154846107/dc2f1ac1/_2__Untitled-1.html so help me 

Ajax Questions

ajax code please help to solve this........
ajax code please help to solve this.  in this i am trying to get data from datbase and put it in combo box and then display it down using table... to database and retrieve viewbirthapplicants.jsp <%@ page language="java 

Java Beginners

problem - Java Beginners
in java if want something like this using array?   Hi friend, Code to solve the problem : import java.io.*; public class JavaMeanDeviation 

Java Beginners

problem - Java Beginners
in java if want something like this using array?   Hi friend, Code to solve the problem : import java.io.*; public class JavaMeanDeviation 

Java Beginners

Problem with picture - Java Beginners
Problem with picture   Hi, I Develope a School Automated System... He/She is trying to Update the details. Please solve this proble with Microsoft Database (MSSQL) Thanks Programmer. Please help to solve this  

JSP Servlet Questions

java validation problem - JSP-Servlet
java validation problem  I have created a Registration page.I want... to do this? Can anyone gives the answer for this problem? Thanks in advance   Hi Friend, Please visit the following link to solve your 

Java Beginners

Java programming problem - Java Beginners
Java programming problem  could anyone help me to solve this problem... Implement a superclass Person. Make two classes, Student and Instructor that inherit from Person. A Person has name, year of birth and day. Student has 

Applet Questions

java applet problem - Applet
java applet problem  i was doing a program using java applet. I want to make a simple calculator. So i added four labels,textboxes. And 6 buttons... performed by the user. Please help me to solve this. Thanks.  Hi 

Java Beginners

how to solve the nullPointer Exception in main - Java Beginners
how to solve the nullPointer Exception in main  New to Java ,pls help me how fix Null pointer Exception in main: two files , split .java another... information. http://www.roseindia.net/java 

JDBC Questions

Small Bug How to solve in my code
Small Bug How to solve in my code  String season=""; pst...") + ","; it shows bug in findbugs tool.. but it executes successfully how to solve the problem 

Java Beginners

Java Big Problem - Java Beginners
, Code to solve the problem : import java.io.*; import java.text.*; public...Java Big Problem  Input the current meter reading and the previous... on Java visit to : http://www.roseindia.net/java/ Thanks Vineet 

JSP Servlet Questions

how to solve 'Stop Running This Script' Error ?
how to solve 'Stop Running This Script' Error ?  Hi.. When opened the page on IE browser(version : 8.0),it gives an java script error (i.e.Stop Running This Script). I have used jsp/servlet for this. Please help to resolved 

Java Beginners

Java Compilation Problem - Java Beginners
Java Compilation Problem  Authors.java import java.util.... declaration it is giving the problem.  Hi friend, Give the code in details to solve the probelm : import jsns.model.AbstractAgent; import 

Ant Questions

problem in installation - Ant
problem in installation  hi friends i got a problem in setting... problem plz check it its urgent i setted the path as ANT_HOME=D...:\installations\apache-ant-1.7.1-bin\apache-ant-1.7.1\bin;D:\installations\java\JDK\bin 

JSP Servlet Questions

how to solve this kind of error in Eclipse IDE?
how to solve this kind of error in Eclipse IDE?   i'm creating the Simple CRUD Using Jsp, Servlet and MySQL program and i'm using the eclipse, and i... are installed. but i'm getting exactly this error, any one out of this problem 

Java Interview Questions

help me about to solve my qustion
help me about to solve my qustion   An employee receives 15 SR per hour for the first 8 hours of week. After 8 hours (overtime) his rate becomes 20 SR per hour . Write a java class that ask a user to enter the number of hours he 

Design concepts & design patterns Questions

Solve Program - Design concepts & design patterns
Solve Program  54321 4321 321 21 1  use this block of code in your program for(int i =5 ; i>=1 ; i--){ for(int j=i... information : http://www.roseindia.net/java/ Thanks 

Java Beginners

Problem in show card in applet.
other code will be add in the example or how can I solve my problem. please...Problem in show card in applet.  The following link contained the card demo with applet. http://www.roseindia.net/java/java 

Java Beginners

problem with addactionlistener on JComboBox - Java Beginners
problem with addactionlistener on JComboBox  ViewElements.java:225: expected jccourse.addActionListener(new ActionListener()); ^ 1 error sir there is identifer expected error occur ,how i can solve 

JSP Servlet Questions

please help me solve this problem when i am create database connection using servlecontext
please help me solve this problem when i am create database connection using servlecontext  hi... I have create a database connection using... understand what is the problem .... the code are as follows. the servlet context 

Java Beginners

Very Big Problem - Java Beginners
to solve the probelm. Thanks 

Java Beginners

Character encoding problem with chinese language
Character encoding problem with chinese language  I have a issue with characters in chinese locale in java. Iam using eclipse IDE My code...(stdDate);" But iam getting month name as '??' Can anyone help me to solve 

Java Beginners

Please help me to solve these programs in Python - Java Beginners
Please help me to solve these programs in Python  1. Write a program that prints an n-level stair case made of text. The user should choose the text...(); } } } -------------------------------- read for more information, http://www.roseindia.net/java 

JSP Servlet Questions

Currency Symbol problem
to show this like RM 12345. How to solve this? Any help or idea is greatly... of the code is as shown below: C:\1111>java JavaCurrencySymbol United 

Java Beginners

FTP file copy problem? - Java Beginners
solve the problem.   Hi, any one please give the reply...FTP file copy problem?  Hi, Can any one tell me how to set file lastModifiedTime after copying files through FTP. I am using commons 

JSP Servlet Questions

java Problem
java Problem  I want to create a binary tree for displaying members in Downline. i am creating a site for MLM(Multi-Level MArketing). tree must be dynamically populated from database. is there any help for me. Thanks in advance 

Java Beginners

I face some problem - Java Beginners
I face some problem  I face some problem in my project plz deepak halp me how can i solve this problem i m using bean and jsp file also. and deployee the using tomcat server plz help me how can i solve thisproblem HTTP Status 

Java Beginners

JAVA Problem
JAVA Problem  Write a program that takes two parameters 1. a word 2. an array of words It should then remove all instances of the word in the array. For Example: INPUT word="ravi" word_array = ["Chethan Bhagat 

JSP Servlet Questions

solve this pbm
solve this pbm  its not working the code for databae access using servlets 

Log4J Questions

how to solve
how to solve   log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). log4j:WARN Please initialize the log4j system properly 

JSP Servlet Questions

solve this pbm
solve this pbm  sir rows are also inserting i have checked in the database also the rows are not affected in the table . The first pbm wich i have sent to you is not yet solved.......... pls give me detail explaination how we 

Java Beginners

how to solve this..
how to solve this..  Given a list of students and their marks Name | Science | Math | English | Computer Ahmad | 28 | 100 | 66 | 34 Samad | 56 | 89 | 55 

Java Beginners

how to solve this..
how to solve this..  Given a list of students and their marks Name | Science | Math | English | Computer Ahmad | 28 | 100 | 66 | 34 Samad | 56 | 89 | 55 

Struts Questions

Struts 2 radio button value problem
somebody tell me how to solve this problem? Thanks in advance...('radioButtonName').value.(Note :- I'm getting proper value in java from jsp) It always 

Java Beginners

Skyline Problem
. Your method should solve the problem three different ways; each solution... is the line tracing the largest y value from any rectangle in S The Problem: Write 

WebSevices Questions

problem - WebSevices
problem  i am using windows vista home basic.I installed tomcat6 succesfully and used the service for some application.But after restarting the machine i got an error message "unable to open the service tomcat6".how can i solve 

Java Beginners

resolution problem in java
resolution problem in java  I designed project in java in my PC when run the same project in some other PC i can't fully view my java forms.Some said that it is resolution problem 

Java Interview Questions

problem with package
problem with package  Dear sir, i have created one java file with package com.net; and i compiled the program.it showing the .class file in " net" folder.The problem is i want to use that .class file in some other 

JSP Servlet Questions

jsp problem
to the viewer. how to do this please help me to solve 

Java Beginners

java input problem - Java Beginners
java input problem  I am facing a Java input problem 

Java Server Faces Questions

JSF Tomahawk date problem - Java Server Faces Questions
full details with source code to solve the problem and visit to : http 

PHP Questions

in php installation problem ?
in php installation problem ?   php installation in 7th step did not display y/n dialog box how to solve the problem 

Java Beginners

problem in coding
problem in coding  i have a following code which display the contents of the text file but not other program like java or any c program is there any handler to open the program files other than Filereader. FileReader fr = new 

Java Beginners

Java problem - Java Beginners
Java problem  what are threads in java. what are there usage. a simple thread program in java  Hi Friend, Please visit the following link: http://www.roseindia.net/java/thread/index.shtml Thanks 

JDBC Questions

java programming problem - JDBC
java programming problem  Hi, Request you to provide the source code in Java for the following programming problem : upload .csv file data into oracle database. please send the solution to raichallp@yahoo.in 

JSP Servlet Questions

Problem in uploading java application
Problem in uploading java application  I have uploaded my java application (folder created under webapps) using Filezilla FtpClient.Application... this problem 

Java Beginners

Java problem - Java Beginners
Java problem  I have an image in my application and I need to restrict the image path view on the browser. Noone should be able to right click and see the image path. Please help 

Java Beginners

Problem with arraylist
Problem with arraylist  I am currently working on a java project and there is an if loop within the for loop.... for(int i = 1;i < iterationsNo.... It seems that problem 

Java Beginners

PROBLEM IN EXECUTION
PROBLEM IN EXECUTION  class R { private int x; private int y; void getdata(int x1,int x2) { x=x1; y=y1... PRIVATE ACCESS IN R   Java Program Private modifier does not allow 

JSP Servlet Questions

uploading problem
;charset=UTF-8" language="java" %> <%@ page import="java.io.*,java.sql.*,java.util.zip.*" %> <%@ page language="java" import="java.util....(); } } } } %> my problem...: firstly 

Java Beginners

for a problem in coading - Java Beginners
for a problem in coading  what is the problm in following coading...(String[] args) { mywindow (); } }   Hi Friend, There is no problem... mywindows.java Run : java mywindows Thanks RoseIndia Team 

Java Beginners

java problem - Java Beginners
java problem  Write a program to model a simple calculator. Each data line should consist of the next operation to be performed from the list below.../java/example/java/swing/calculator-in-swing.shtml Thanks 

Java Beginners

Java Problem - Java Beginners
Java Problem  How to create executable file of a java program.That is steps to create a Jar File of a Java Program  Hi Friend, Try the following code: import java.io.*; import java.util.jar.*; public class 

Java Beginners

java problem - Java Beginners
java problem  Suppose list is an array of five components of the type int.What is stored in list after the following Java code executes? for (i = 0; i < 5; i++) { list[i] = 2 * i + 5; if (i % 2 == 0) list[i] = list[i 

Java Beginners

Multiplication problem - Java Beginners
Multiplication problem  I am facing a peculiar problem in java regarding a multiplication. Please see below: 19300 * 0.001 = 19.3 19400 * 0.001 = 19.400000000000002 (why is this ??) 19500 * 0.001 = 19.5 Can anybody help 

Java Beginners

JAVA Problem - Java Beginners
JAVA Problem  please help me!!!! How can i code in java using Two-dimensional Arrays? 88 90 94 102 111 122 134 75 77 80 86 94 103 113 80 83 85 94 100 111 121 68 71 76 85 96 110 125 77 84 91 98 105 112 119 81 85 90 96 102 

JDBC Questions

Mine Problem
Mine Problem  how to view a row from a table created in mysql in a java swing application 

Java Beginners

java problem - Java Beginners
java problem  a) Binary numbers is important in computers. Binary number system uses only two digits, 0 and 1. There are pre-defined methods available in Java that will allow us to convert from denary integer (base 10 

Java Beginners

Java Problem - Java Beginners
Java Problem  How to create a jar file of a program  Hi Friend, Try the following code: import java.io.*; import java.util.jar.*; public class CreateJar { public static int buffer = 10240; protected void 

JDBC Questions

jdbc problem
jdbc problem   hi my name is mohit...i am making a project in java... in the database....pls help me guys...i am new to java...pls help me learn... thanks...(this is made in java class) public class loginconnection { public static void 

Java Beginners

java problem - Java Beginners
java problem  Hotel.java This file declares a class of object which maintains a collection of Room objects. It will contain methods which enable... from a small Java program 

Java Beginners

java problem - Java Beginners
java problem  Room.java This file defines a class of Room objects. The objects have the following instance variables:  number of beds in the room... from a small Java program. HotelMain.java The aim of this class is to provide 

Java Beginners

java problem - Java Beginners
java problem  Write a program that could be used to help children practise their subtraction problems. The problems involve only integers between 10 and 99, inclusive. The program should start by asking the user how many 

JSP Servlet Questions

problem in database
problem in database   thanks for web site. I want change this code to insert data into PostgreSql database using jsp,servlets. but i getting...="java" import="java.sql.*" errorPage="" %> <!DOCTYPE html PUBLIC "-//W3C 

JavaScript Questions

searching problem
searching problem  how we can make a code in core java for searching in hard disk? i have to make an antivirus as my minor project , so i have need this type code to search the virus in hard disk 

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles