1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nasty-shy [4]
3 years ago
7

Create another method: getFactorial(int num) that calculates a Product of same numbers, that Sum does for summing them up. (1,2,

3 ... num) Make sure you use FOR loop in it, and make sure that you pass a number such as 4, or 5, or 6, or 7 that you get from a Scanner, and then send it as a parameter while calling getFactorial(...) method from main().
Computers and Technology
1 answer:
Mandarinka [93]3 years ago
3 0

Answer:

The program in Java is as follows;

import java.util.*;

public class Main{

public static int getFactorial(int num){

    int fact = 1;

    for(int i =1;i<=num;i++){

        fact*=i;

    }

    return fact;

}

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 System.out.print("Number: ");

 int num = input.nextInt();  

 System.out.println(num+"! = "+getFactorial(num)); }}

Explanation:

The method begins here

public static int getFactorial(int num){

This initializes the factorial to 1

    int fact = 1;

This iterates through each digit of the number

    for(int i =1;i<=num;i++){

Each of the digits are then multiplied together

        fact*=i;     }

This returns the calculated factorial

    return fact; }

The main begins here

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

This prompts the user for number

 System.out.print("Number: ");

This gets input from the user

 int num = input.nextInt();  

This passes the number to the function and also print the factorial

 System.out.println(num+"! = "+getFactorial(num)); }}

You might be interested in
The two mathematical models of language description are generation and recognition. Describe how each can define the syntax of a
JulijaS [17]

Answer:

The correct answer to the following question will be "Semantic and Syntax error".

Explanation:

<u>Syntax error: </u>

Corresponds to such a mistake in a pattern sentence structure that is composed in either a specific language of that same coding. Because computer programs have to maintain strict syntax to execute appropriately, any elements of code that would not adhere to the programming or scripting language syntax can result inside a syntax error.

<u>Semantic error: </u>

That would be a logical error. This is because of erroneous logical statements. Write inaccurate logic or code of a program, which results incorrectly whenever the directives are implemented.

So, it's the right answer.

3 0
3 years ago
List four significant differences between a file-processing system and a database management system (DBMS).
melisa1 [442]

Answer is given below

Explanation:

differences between a file-processing system and a database management system is given below

file-processing system

  • File system is a software that manages and organizes the files in a storage medium within a computer.
  • It doesn’t provide backup and recovery of data if it is lost.
  • There is less data consistency in file system.
  • File systems provide less security in comparison to DBMS.
  • It is less complex as compared to DBMS.

database management system

  • DBMS is a software for managing the database
  • It provides backup and recovery of data even if it is lost.
  • DBMS has more security mechanisms as compared to file system
  • It has more complexity in handling as compared to file system.
  • There is more data consistency because of the process of normalization.
7 0
3 years ago
1. what do to call the process of preserving food by soaking the raw ingredient in salt and water solution.
garri49 [273]

Answer:

Salting is the preservation of food with dry edible salt. It is related to pickling in general and more specifically to brining also known as fermenting (preparing food with brine, that is, salty water) and is one form of curing.

Explanation:

5 0
2 years ago
My mom works from home selling her craft work online to people all over the world. She can do this from home because we have acc
postnew [5]
The computer and a device
7 0
3 years ago
Read 2 more answers
Given the number of rows and the number of columns, write nested loops to print a rectangle. (PYTHON)
Allushta [10]

Answer:

Explanation:

Please see the attached picture for help.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Using a loop, write a program that reads in exactly five integers and outputs the sum.
    11·1 answer
  • A database interrogation is a major benefit of the database management approach, where end users can query (“ask”) the database
    6·1 answer
  • What is the drawback of the linear model?
    5·2 answers
  • : How does the founder of Wikipedia keep a tight reign on accuracy? HELP PLEZ AT LEAST A PARGRAPH PLES
    6·1 answer
  • Jim has to send an email to his boss requesting medical leave. in which field will Jim type the purpose of his email?​
    8·2 answers
  • Suppose you are on a desert island and possess exactly 20 coconuts your neighbor Friday is a fisherman and he is willing to trad
    14·1 answer
  • Which of the following code is correct? I: print("Programming is fun") print("Python") print("Computer Science") II: print("Prog
    11·1 answer
  • Write a function process_spec that takes a dictionary (cmap), a list (spec) and a Boolean variable (Button A) as arguments and r
    10·1 answer
  • Write a program that: Takes the list lotsOfNumbers and uses a loop to find the sum of all of the odd numbers in the list (hint:
    5·1 answer
  • Which one of the statements best characterizes the current state of e-commerce?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!