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
bulgar [2K]
3 years ago
15

Write code statements that prompt for and read a double value from the user, and then print the result of raising that value to

the fourth power. Output the results to three decimal places.
Computers and Technology
1 answer:
andriy [413]3 years ago
5 0

Answer:

Following are the code in Java Language:

Scanner sc = new Scanner(System.in); // create a instance of scanner class

DecimalFormat frmt = new DecimalFormat("0.###"); // create a instance of                // DecimalFormat class

System.out.println ("Enter the value: ");

double number = scan.nextDouble(); // Read the value by thje user

System.out.println (fmmt.format(Math.pow(number, 4))); // display the value

Explanation:

Following are the description of the code

  • Create an instance scanner class i.e "sc".
  • Create an instance of DecimalFormat class i.e "frmt".
  • Read the value by the user in the "number" variable of type double by using the nextDouble()method.
  • Finally, display the value by using System.out.println method. In this, we call the method format. The Math.pow() function is used to calculating the power up to the fourth value.

You might be interested in
What are the benefits of writing functions that use parameters and return List 2 please and explain what is return
Ratling [72]

<u>Answer and explanation:</u>

There are many benefits of writing functions that use parameters and return. Some of them are:

1. Flexibility: With functions having parameters, several values of the parameters can be used at invocation time thereby making the application flexible. For example, given the following function in Java.

<em>public void showName(String name){</em>

<em>    System.out.println("Your name is " + name);</em>

<em>}</em>

To call this method (function), the programmer could use various values for the name parameter used in the function like so:

showName("John");

showName("Doe");

If the function didn't have a parameter, it is possible it will only print a hardcoded name every time the function is called.

2. Scope Control: When a function is allowed to return a value, it helps to work around scope issues since variables declared within a function are limited to that function and do not exist outside the function. This means that the values of these variables cannot be used anywhere else outside the function in which they are being declared. However, if the function returns a value, the value can be used anywhere else in the program.

For example:

<em>public String getDouble(int x){</em>

<em>    int y = x * 2</em>

<em>    return y;</em>

<em>}</em>

The function above returns twice the value of the argument supplied to it. Since the integer variable y is declared within the function, it's value cannot be used outside the function. However, since the value is being returned by the function, it could be used anywhere the function is being called. Thanks to the return keyword.

3 0
3 years ago
PLS HELP) Early word processors ran on devices that looked like digital _______?
stealth61 [152]
I looked it up it just says true
8 0
3 years ago
Read 2 more answers
. Question 1. Given the following grammar S → aAb | bBA A → ab | aAB B → aB | b and for each of the following right sentential f
zmey [24]

Answer:

Explanation:

(a) aaAbb (b) bBab (c) aaAbB b

The parse tree and phases are shown in the attached diagram below

5 0
3 years ago
Read 2 more answers
in Google, how should you phrase your search if you want to exclude a certain word from your results(for example,"chocolate")?
dusya [7]
I found this:
ou can exclude words from your search by using the - operator; any word in your query preceded by the - sign is automatically excluded from the search results. Remember to always include a space before the - sign, and none after

I found it here:
http://www.informit.com/articles/article.aspx?p=675274&seqNum=3
3 0
3 years ago
To make a duplicate of text, image,chart,graphs etc.​
Veronika [31]

Explanation:

You can change the formatting of the rest of the text ( bold, italics, font color or sixe, ect)

5 0
3 years ago
Other questions:
  • 1. An Excel file is called a workbook?<br> A) True<br> B) False
    6·2 answers
  • Which is the quickest way to change the font color in multiple, randomly located cells in a worksheet
    8·2 answers
  • Which best explains what a credit score represents
    10·2 answers
  • Python provides a special version of a decision structure known as the ________ statement, which makes the logic of the nested d
    13·1 answer
  • Computer software licensed under exclusive legal right of the copyright holder with the intent that the licensee is given the ri
    6·1 answer
  • Who is your favorite smite god in Hi-Rez’s “Smite”
    14·1 answer
  • The one who will defeat me in this typing race I will mark the one brainliest:
    5·2 answers
  • What is the exclusive legal right granted to all authors and artists that gives them sole ownership of their work to print, publ
    5·2 answers
  • A list is a collection that ______________
    9·1 answer
  • Which of the following is a property of TCP?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!