Please help. I am a beginner in java. Just a simple program that takes input from user for simple calculations. Please give the code of a simple program like this rest I will manage.
121545
Taking input in commandline is not as simple as it is in C of c++. U need use Sytem.in and get the inputstream and then use it.\n\nI recommend u to use swing JOptionPane that shows a input dialog and and get the input from the user.\n\nHere is the sample using Swing\n\nimport javax.swing.JOptionPane;\n\npublic class UserInput\n{\npublic static void main(String[] args)\n{\n    String str = JOptionPane.showInputDialog( null , "Enter Something");\n    System.out.println(str);\n}\n}
176297
I can't really figure out what you are trying to do? How are the numbers going to be turned into months? How are you trying to output them? I don't know if you left this code out, but this would be helpful in answering. Please post more details.
209968
Phew given yourself a task here laddie....\nAnyhow go to www.wrox.com and they have a whole section dedicated to java,(and just about everything) be patient, be cool and you will get there\n\nGood luck
546297
hi,\ndo loop is first excecute the task and then its check the condition.\n\ntime 1:\n---------\nd=0, i=20.\n\nd=d+(1.0/i)\nd=0+(1.0/20)\nso new d=0.05\n\nand at the same time,\ni=i/(-2)\nso new i=20/(-2)\nnew i=(-10)\n\nnow the d=0.05\nand i=(-10)\n\nand then its check the condition.\ni<5\n(-10) < 5 is true\nso it wil run the loop again,\n\nso nw come to the 2nd level...\n\nTime 2:\n----------\nd=d+(1.0/i)\nso d=0.05+ (1.0 /(-10)\nnew d =0.05+ (-0.1)\nnew d=0.05-0.1\nd= (-0.05)\n\nand concider abt i,\ni=i/(-2)\ni=(-10)/(-2)\nso new i = (+5)\n\nnow lets checks the condition,\ni < 5\n+5 < 5 is fals, \nso the program s terminated.\n\nso now the value of d= (-0.05)\n\nr u clear?\nthis is a gud egsample for tha do while loop,\nHav fun bro,\ntc.
449148
import java.awt.*;\nimport javax.swing.*;\n//\n// A Simple Java Application that make use of the  Swing package\n//\npublic class Sample {\nprivate JFrame jF;\nprivate JPanel jP;\nprivate JButton jB;\n\npublic void go() {\njF = new JFrame("Sample");\njP = new JPanel();\njP.setBorder( BorderFactory.createEmptyBorder(30,30,30,30));\njP.setLayout(new GridLayout(0,1));\n\njB = new JButton("Click Here");\njB.setToolTipText("Please Click This Button");\n\njP.add(jB);\njF.setContentPane(jP);\n\njF.pack();\njF.setVisible(true);\n}\n\npublic static void main(String args[]) {\nSample s = new Sample();\ns.go();\n}\n}\n\n/* Save the file as Sample.java and compile. */\n/* Note the codes are for your reference only. Change it and run it to ensure you understand what each part is for. You will learn only by writing your own codes. */
645627
OH NOES THIS IS LIKE A MATH PROBLEM!!!! i can't handle any more variables :( sry.\n\n\nhahahaha.
26384
I'm not exactly sure what you mean?\n\nAre you trying to run a Java application and the main method can not be found?\n\nIs there a specific error message you are seeing that you can add to the details of this question?
410171
Here are the steps you need to take to write this program:\n\n1) Learn to program.\n2) Write your program.\n\nSorry, but there are no shortcuts in programming, no magic "write my program" wizards, no "instant application" kits...\n\nRawlyn.
486061
the type of project depends on how new you are to Java. if you are just beginning to learn java, then try out some basic examples like printing statements and stuff. \nif you are through with the Core part of Java, then you can design an application using AWT, ie., applets. the best thing to do for a starter is to develop a Calculator using AWT.  this is the project i did when i was new to Java. it will help you a lot in strengthening your concepts in Java. \nthe calculator can be a simple one or a scientific one, which depends on your interest and scope. try this and i will assure you that this will help a lot.
94786
#include<iostream.h>\nint main() \n{ \n   int stop=false;    \nchar pl='X';    \nchar p; //is used for checking when a game is won  \n  \nint v; //value    \nchar list[]="123456789&#92;0"; //create our array that holds all the values \n\n   do { //start our while loop        //INPUT \n       cin >> v;        //MARKING \n       if (list[v-1]!='X' and list[v-1]!='O')\n {       \n    list[v-1]=pl;       \n }        \nelse\n {  \n     cout << "That place is already taken.&#92;n";   \n      goto skip; //if its already taken skip the turn switch             \n}  \n    if (pl=='X')\n {  \n          pl='O';  \n   }\n   else\n { \n \n          pl='X';  \n      }        skip:;        //win checks   \n     for (int w=0; w<2; w++)\n{    \n        if (w==0)\n{       \n        p='X';   \n         } \n           else{ \n                p='O'; \n           }\n     for (int z=0; z<9; z=z+3)\n {\n     if (list[z]==p and list[z+1]==p and list[z+2]==p) {                 \n  stop=true; \n        goto GAME_END;    \n            } \n           }\n            for (int z=0; z<3; z++) { \n        if (list[z]==p and list[z+3]==p and list[z+6]==p) {\n                   stop=true;            \n       goto GAME_END;        \n        }  \n          }        \n    if (list[0]==p and list[4]==p and list[8]==p or list[2]==p and list[4]==p and list[6]==p)\n{     \n          goto GAME_END;   \n         }   \n     } \n       //PRINTING OF THE VALUES       \n for (int x=0; x<9; x++) {  \n           cout << list[x];   \n          if (x==2 or x==5 or x==8) {  \n              cout << "&#92;n";    \n         }    \n    }   \n     //END PRINTING OF THE VALUES \n       //system("PAUSE");   \n }\n while (stop==false); \n//End the while loop    \nGAME_END:;      \n  cout << p << " wins!&#92;n";      \n  system("PAUSE");\n}
105213
go to the website below for JAVA codes\nhttp://javasrcipt.internet.com\nfor help about html go here\nhttp://www.w3schools.com/html/
369632
If you want to know visit www.java.com\n\nHope ds is d best answer!
642950
The first is a Java Class called Main.\n\nThe second is the constructor for this class. This is what isused to basically set the class up and make an instance of it.\n\nThe third is a method called main which takes in a string array which you have named args. You could call args whatever you want, its juts a general name most coders put on it. It has a modifier which is static and is public so other classes can invoke it. The main method is what is looked for by the java compiler at run time when you execute the program.\nSo a class may look like this:\n\npublic class Main\n{\npublic String greeting;\n\n public Main()\n{\ngreeting = "hello"\n}\n\npublic static void main(String[] args)\n{\nSystem.out.println(args[0]);\nSystem.out.println(greeting);\n}\n}\n\nThis would result in the value stored at args[0] being printed out. Then "hello" printed out on a new line.\nThe args are the arguments that you pass to your program. Most programs take in strings or ints.
152886
why should "balance after" add up to anything like the same number?   Try this:\n\nwithdrawal..... balance after\n99..............1\n1...............0\ntotal=100......total=1
261451
Hello there, you need to down load Java....\nHttp://www.java.com
534782
I see two issues, in addition to the division problem pointed out above.  First, you should initialize your variables.  In particular, set sum=0 at the beginning of your code. Do the same for counter.\n\nNext, you have logic issues.  For min and max, you have to initialize these variables, but just setting them to 0 may not work.  If the user enters a series of negative values, you may falsely report 0 as a max. So, the classic solution is to initialize min and max to the first number given by the user.  Of course, this means you'll have to prompt the user for input outside the loop.\n\nBut actually, this helps to solve the other problem.  In particular, when the user enters 0, you still increment your counter. It would be best to redesign your code a little so that the loop condition guarantees that the most recent user value is not zero. You can do this by changing the type of loop that you use, and by asking for the first value outside the loop. \n\nI haven't quite given you all the details, but that's because I want you to think about it yourself.  It'll be a valuable exercise.
42922
Your object will be passed by reference because\nthat's how Java passes all objects.  Only the\nprimitive types like "int" are passed by value.