Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Java applications? Basic help.?
My assignment is to: Write an application to perform simple arithmetic operations on integers.
I'm using Netbeans IDE 8.0 to write this application, but I have no clue what I'm doing. What does a finished application look like? My application is supposed to do the following:
Prompt the user to enter five integer values from the keyboard.
Display the sum and average of the numbers.
Display the quotient of the first number divided by the second.
Display the remainder of the fourth number divided by the fifth.
How on earth would I go about doing these things?
Please help!
Sincereley, Technologically Illiterate
7 Answers
- JamieLv 77 years agoFavorite Answer
In order to create an application that does the tasks that you mentioned in your question, you should first create a class and then think about what you will need in order to get users' input, store the values, as well as perform and print out the results of the operations that are required.
Since your application requires the user to enter five integer values, you can use some "int" variables or an "int" array to store the values, an object of the "Scanner" class to get the input, as well as a "for loop" to get the values one after another. (Alternatively, you could use multiple Scanner class objects, which would also work, but makes for more code, which could be less efficient.)
Once you've read in all of the values, you can simply use the variables or array indices to perform the required mathematical operations and then you can print the results to the screen! (You could also create a few variables for this, in order to make it easier to keep track of all of the values and results.)
You may want to try writing some pseudo-code or even creating a diagram, etc. to help keep your thoughts and ideas organized, which may help in writing the code for this application.
As for an example of how to write a Java application, here's a link to some code that I wrote and posted on PasteBin.com, which shows how to get user input, use variables to store the user-entered integers, use a "for loop" and add the values together, as well as how to print the values and the total to the screen.
Best of luck and I hope I helped you!
- Andy TLv 77 years ago
Who in the world told you to use NetBeans IDE for this? Even DrJava is more than adequate for this and it is very simple to use compare to Eclipse and NetBeans.
Next reearch "Hello World" in Java nd other small snippets on the 'Net. Piece together a solution for your assignment on your own. "Hello World" usually not assignment; Non-Structure is the point of it when I was in college.
- Anonymous7 years ago
When will you learn java and make first program then there will be much more question put up you.
- 7 years ago
best way to learn is find the ans by your self.
i can give u some hint,
Find about Scanner class
also you will need to do a reach about arithmetic operators in java
good luck.
- How do you think about the answers? You can sign in to vote the answer.
- Anonymous7 years ago
You should try it by yourself. If you are don't know the syntax there are lots of java basics tutorials site..I am suggesting you some good sites.just go through them http://www.tutorialspoint.com/ , http://www.learnjavaonline.org/
- Anonymous5 years ago
u can use java applet. make use of backend for db, works great wid oracle.