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

  Java code using jframe

Write a Java code using JFrame. This code needs to manipulate 4 shapes(2 rectangles and 2 squares) in a 400x400 JFrame. This needs to manipulate the shapes in 3 different ways, using 3 different methods. One for translating a shape, one for proportio..

  Create the class airplane

Your missions is to create the class Airplane. Each Airplane object should store the following information (fields):

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Implement simple java program to input syllabus grades

To implement simple Java program to input (hypothetical) syllabus grades, computing and displaying both normal Mean and Harmonic Mean.

  Build the gui layout of the game

Build the Build the GUI layout of the game in java.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Creating the gui for the game interface

A GUI-based application that allows a user to play a simple trivia game

  Display random numbers to simulate rolling a die

1. Display random numbers to simulate rolling a die2. Create a java program that simulate a casino game. (rollin a die)

  Write a program that reads in a list of numbers from a file

write a program that reads in a list of numbers from a file and adds up all those numbers. You may hard code in the name of the file, allowing the user to input the filename is not required

  Enterprise java beans (ejb) in software development

Enterprise Java Beans (EJB) in software development, EJB technology, EJB application, Stateless Session Beans (SLSB), Stateful Session Beans (SFSB), Message Driven Bean (MDB), Entity Bean

  Use inheritance to read, store, and print questions for test

use inheritance to read, store, and print questions for a test. First, write an abstract class

  Design a function named "falling distance"

Design a function named "fallingDistance" that accepts an objects falling time, in seconds, as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Design a program that calls the func..

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