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

  What position along the chord does minimum pressure occur

At what position along the chord does the minimum pressure occur? What is special about the point where C p is a maximum?

  Write a java program to register students for a college

Project is for designing and developing a College Registration program. Write a Java program to register students for a college

  Design a course registration system

Create an application which represents a simplified course registration system using ArrayLists and HashMaps.

  Write function in javascript to compute person-s gross pay

Write the function using JavaScript syntax to compute a person's gross pay for a week. The function should receive the number of hours worked and the rate of pay per hour.

  How to count number of objects (instances) created

How to count number of objects (instances) Created, use java code and please be descriptive

  An elementary calculation yields the result

An elementary calculation yields the result that theoretically, the probability of turning up 7 when two dice are thrown is 1/6, or .166666. But what if more dice are thrown? If 3 dice are thrown, what is the probability that some 2 of three sum to 7..

  Create web application uses visual web java server

Create the Web application which uses Visual Web Java Server Faces framework and either Apache Tomcat or Glassfish as the server.

  Create a calculator function

This is the code for my trip planner,you need to figure out how to create a calculator function to enable users to calculate their own costs if they choose

  What is the average response time for this system?

A web server receives a request every 50ms and processes web requests every 8 ms. Using queuing theory, 1. What is the average response time for this system?

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Java threads

This is an introductory assignment on Java synchronization. You will use Java Threads while learning more about concurrency and achieving atomicity using Java’s inbuilt mechanisms.

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