Add to favorites
Nederlandse versie: Consejeros Gratis adviseurs Usa version: Advisors 4 Free Version franšaise: Conseils Gratuits Versione italiana: consigligratuiti.it Belgische versie: gratisadviseurs.be Versiˇn espa˝ola : Consejeros Gratis Deutsche Version: Gratis Beraten
Current location:Home » Computers » Programming » Java & JavaScript Programming
Advertise on this site?

Ask a Question?

Ask a question about Java & JavaScript programming online. You'll receive an answer of a Java & JavaScript programming Specialist.

Do you have a question over the topic Java & JavaScript programming? Click here. More questions about Java & JavaScript programming.

Current Administrator for the topic Java & JavaScript programming:
Name: Zrdnpmgfx
Business name: Khbjvuguymjuycwo
Reaction time: hours
Rating: 0.0 (max. 10)
More informatins on Zrdnpmgfx can be found in his profile page.

Become advisor?

RSS about Java & JavaScript programmingQuestions about Java & JavaScript programming via RSS. Click here.
RSS about Java & JavaScript programming on your site?Questions about Java & JavaScript programming on your site? Click here.
Keep informed via e-mail about Java & JavaScript programmingQuestions about Java & JavaScript programming via E-mail. Click here.

How do i do a factorial calculator in Java

Posted on: 2018-02-26 12:37:59]

Explanation:
I have an assignment due tomorrow about a factorial program in Java; I have 2 classes (I'm a begginer, begginer, begginer in this! :) ); and in one class i have to write the program so that java will calculate whats in the other class; i have to calculate the fatcorial of numbers from 0 to 4; as i've written until now, it only calculates tha factorial of 0 and 1; I know its something very simple, but I can't figure it out!! Can somebody please help me?


package test;


import static org.junit.Assert.*;


import org.junit.Assert;

import org.junit.Before;

import org.junit.Test;


import code.FactorialCalculator;


public class TestFactorial {


private FactorialCalculator calculator = new FactorialCalculator();



@Test
public void testFactorialOf0() {

int result = calculator.calculate(0);

Assert.assertEquals("Factorial of 0:", 1, result);
}



@Test
public void testFactorialOf1() {

int result = calculator.calculate(1);

Assert.assertEquals("Factorial of 1:", 1, result);
}



@Test
public void testFactorialOf2() {

int result = calculator.calculate(2);

Assert.assertEquals("Factorial of 2:", 2, result);
}



@Test
public void testFactorialOf3() {

int result = calculator.calculate(3);

Assert.assertEquals("Factorial of 3:", 6, result);
}



@Test
public void testFactorialOf4() {

int result = calculator.calculate(4);

Assert.assertEquals("Factorial of 4:", 24, result);
}

}
Answer:
This question doesn't have an answer.


Other guestions related to How do i do a factorial calculator in Java:

print text in vertical direction using java
      [Asked in Java & JavaScript programming]
2018-02-17 05:56:05
How/Where to set property AWT.DnD.flavorMapFileURL
      [Asked in Java & JavaScript programming]
2017-04-07 06:39:35
Data mining classification part error
      [Asked in Java & JavaScript programming]
2017-03-23 11:53:51
transaction t = (transaction)transactionTable.ele
      [Asked in Java & JavaScript programming]
2016-12-30 17:41:02
drag and drop from browser to desktop using java
      [Asked in Java & JavaScript programming]
2016-08-09 02:25:57

Inform a friend about this question.
 
Your name:
Your e-mail:
Friend's name:
Friend's e-mail:
+ insert more friends
 
Message:
Check:
 



Disclaimer | Sitemap | Archive | Links | last 100 questions | Popular archive

Top 3 Advisors

  • Toon Hasselman
    9.8

  • 9.8
  • Sanjeev Kumar
    9.2
  • Totals:

    Questions:  1860
    Administrators:  55

    Averages:

    Already answered:  17 %
    Response time:  940 hours
    Rating:  7.5
Your advertisement here?

Concept & Web design Webshop+