Write a java program that accepts a positive long integer

Assignment Help JAVA Programming
Reference no: EM13163320

Write a Java program that accepts a positive long integer between 2 to 15, and then using the number, calculate its factorial (n!). Using do-while statement, make sure it only accepts a valid number (between 2 and 15) - if an invalid number is entered, program should display the original instruction again, using while loop.

Hint: all variables should be declared as long.

Hint: After do-while loop for input validation, use for-loop to get the factorial

*** Sample output

Enter a between number 2 and 15:

15

Factorial of 15 is 1307674368000

 

Reference no: EM13163320

Questions Cloud

What is the specific gravity of isopropyle alcohol : a 5.00 mL sample of isopropyl alcohol has a mass of 3.930 g when measured at 20 degrees Celsius? what is the specific gravity of isopropyle alcohol?
Function named sort that takes three integer parameter : Write a function named sort that takes three integer parameters by reference. The function should rearrange the parameter values so that the first parameter gets set to the smallest value, the second parameter gets set to the second smallest value, a..
A brief history about the combustion of butane : write a report about the chemical equation about the combusiton of butane. the report must include the equation, a brief history about the combustion of butane and its importance to the world and any dangers involved.
Class diagram represents the relationship between parents : Draw a class diagram that represents the relationship between parents, children, and grandparents. Take into account that a person can have both a parent and a child. Annotate associations with roles and multiplicities.
Write a java program that accepts a positive long integer : Write a Java program that accepts a positive long integer between 2 to 15, and then using the number, calculate its factorial (n!). Using do-while statement, make sure it only accepts a valid number (between 2 and 15) - if an invalid number is ent..
How many moles of excess sulfuric acid are left over : 500.0 g of ammonia react with 51.0 moles of sulfuric acid to produce ammonium sulfate. How many moles of excess sulfuric acid are left over after the reaction is complete?
A graph is two-connected iff : A graph is two-connected iff, removal of any single vertex and the edges adjacent to that vertex, leaves the graph connected. How can we tell if a graph is two-connected? Explain your algorithm in English
Which reduces the solubility of calcium fluoride : Which of the following reduces the solubility of calcium fluoride?
How much heat in kilojoules is required to warm : How much heat in kilojoules is required to warm 10.0 of ice, initially at -10.0, to steam at 125. The heat capacity of ice is 2.09 and that of steam is 1.84 .

Reviews

Write a Review

JAVA Programming Questions & Answers

  Distributed systems

Build robust, secure distributed systems using advanced programming techniques

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Create a java program

UserApp and PrettyPrintUtility multiple times (supplying different TransData test file names), the AutoTesterUtility PROGRAM will be the driver program.

  Write a program to find solution tocryparithmetic puzzle

Write a program (Crypta.java) that finds a solution to the cryparithmetic puzzle: TOO + TOO + TOO+ TOO = GOOD

  Multiple choice java programming questions

Determine which of the following may be a violation of information hiding if inserted for the comment above?

  Loops and files

Convert an algorithm using control structures into Java and write a while loop

  What makes a program easy to modify

Describe the order of magnitude of the code section using Big(O) notation and Explain the relationship between dynamic storage allocation and recursion.

  Write a program that reads a set of floating-point

Write a program that reads a set of floating-point data values from the input.

  Java application to generate three-digit random number

Write a Java application that generates a 3-digit random number 100 times. Display the output for each of the generated numbers and the sum of all 100 numbers.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Write down ijvm code to remove top two words from stack

Write down IJVM code which will remove these top two words, multiply and put their product back on stack. You are allowed to use existing IJVM instructions only.

  Instance methods

instance methods: setWidth(double w), setHeight(double h), double getWidth(), double getHeight() and double getArea() * A triangle's area is calculated by width*height*0.5  * all variables are private and methods public.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd