Share on Google+Share on Google+

charles kaifiti
IJVM
1 Answer(s)      5 years and 11 months ago
Posted in : Java Magazine

using IJVM..can anybody help me in this question

User should be prompted to enter two non-negative numbers (say, a and b where a >0 and b > 0) line by line and then press the enter key. Your program should calculate and display the following for these numbers (see sample output below): Sum (a + b) Difference (a - b or b - a, whichever gives a positive value) Product (a x b) Power (ab)

OUTPUT Num1: 2 Num2: 10 Sum = 12 Difference = 8 Product = 20 Power = 1024 Num1: a Invalid Number Num1: x End of program

Implement the above in a loop so that the user is prompted to keep entering two numbers and the program produces the required results for each set of numbers until user enters â??xâ?? (character x) which should halt (end) the program.

?· Validate your inputs to only accept non-negative numbers as input (i.e. n â?¥ 0). Hence, if user enters characters like negative numbers, alphabets or any other character; your program should display some appropriate error message and prompt for another valid number.

?· Use appropriate subroutines (functions/methods) in your program. For example, each mathematical operation/function could be in a subroutine.

?· Write appropriate comments and use good programming techniques in your code where possible.

Ads

View Answers

May 30, 2011 at 2:52 PM











Related Tutorials/Questions & Answers:
IJVM
in IJVM. For example, if two numbers 2 and 3 are on the stack, the power function... value and b being the value on top). Write an IJVM code segment... are allowed to use existing IJVM instructions only. Include appropriate comments
IJVM
in IJVM. For example, if two numbers 2 and 3 are on the stack, the power function... value and b being the value on top). Write an IJVM code segment... are allowed to use existing IJVM instructions only. Include appropriate comments
Advertisements
IJVM
IJVM  using IJVM..can anybody help me in this question User should be prompted to enter two non-negative numbers (say, a and b where a >0 and b > 0) line by line and then press the enter key. Your program should
Tutorials   
Java Spring Hibernate Struts Training Default value of path variable in Windows 7 Windows 7 refresh DNS 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1) how to change a column data in a every row in a text file in java cursor location what is the Advantages moqui framework vs other frameworks what is the difference between moqui framework vs other frameworks Develop Bulk SMS sender Bundle of servers interface ALU Computer Term How to find the size of a dynamic webpage using java... eg : Youtube........ Question in Create Arraylist ? active window means 1024 bytes equals to can a volatile memory loss data on power cut What is E-Learning? What is E-Learning? What is hacker? different types of storage devices of a computer Examples of optical disk Main job of cpu Main memory is also known as Define computer software. connection between your computer and local isp which part of the cpu does math calculations What is procedure Where i can use UNIX Operating System? What was ENIAC One byte consists of how many bits? What is the use of Bluetooth technology basic function of computer system how to measure data transfer speed GIGO Full Form What is parallel port where are program instructions and data values stored Nible is a computer network is referred as The input device used by computer is The product of data processing is The CPU(Central processing unit)consist of One-thousand of a second is called Alternate facilities of programs, data files, hardware equipment, etc. One-Millionth of a second is referred as Storage medium that loses its contents A LSI chip contains the entire CPU of computer except main memory is called ascending order of a data hierarchy Combining records from two or more orders files into a single ordered file is called Computer questions for Bank PO Exams and upsc competitive exams characteristics of a modem computer

Ads

 
Advertisement null

Ads