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
pentagon [3]
3 years ago
10

Write a Java application that uses the Math class to determine the answers for each of the following: a. The square root of 37 b

. The sine and cosine of 300c. The value of the floor, ceiling, and round of 22.8 d. The larger and the smaller of the character ‘D’ and the integer 71 e. A random number between 0 and 20 (Hint: The random() method returns a value between 0 and 1; you want a number that is 20 times larger.) Save the application as MathTest.java.'
Computers and Technology
1 answer:
gayaneshka [121]3 years ago
5 0

Answer:

import java.util.Random;

public class MathTest {

   public static void main(String[] args) {

       int a = 37, b = 300;

       double c = 22.8;

       int max;

       System.out.println("The Square root of 37 is "+ Math.sqrt(a));

       System.out.println("The Sine of 300 is " + Math.sin(b) + " and the cosine is "+ Math.cos(b));

       System.out.println("The Floor, Ceiling and Round Value of 22.8 respectively are "+Math.floor(c)+", "+Math.ceil(c)

               +", "+Math.round(c));

       max = Math.max((int)'D',71);

       System.out.println("The Maximum between D and 71 is " +max );

       Random rand = new Random();

       int RandValue = rand.nextInt(20);

       System.out.println("A random Number between 0 and 20 is "+ RandValue);

   }

}

Explanation:

In order to get the square root of the number 37, the square root function is called by the statement Math.sqrt(a) since the value 37 has been assigned to a. Method calls are also applied to find the cosine, sine, floor, round and ceiling values for the respective variables.

To determine the maximum between the character 'D' and the integer 71, we first cast the character 'D' to an integer using this (int)'D'. Then we make the Method call Math.max( ).

To generate a random variable between 0 and 20, we first make an object of the class Random we use this object to obtain a random number between 0 and 20 by specifying the bound to 20 during the method call.

You might be interested in
The primary reason for the creation of the Federal Reserve System LOADING... ​was: A. to create a single central bank similar to
Gelneren [198K]

Answer: (C) to reduce or eliminate future bank panics.

Explanation:

The Federal Reserve System being the central reserve system in the US was created with the primary objective of reducing and eliminating bank panics in periods of recessions and depressions and other bank related matters.

3 0
3 years ago
The process of _____ determines what volume a system can handle by comparing its performance to standards in the industry? horiz
Alina [70]

BENCHMARKING

option C

5 0
3 years ago
Read 2 more answers
Your ipad has an application that will not stop running. what feature/tool can you use to stop it? kill treason task manager for
saveliy_v [14]

you could force quit

6 0
2 years ago
Read 2 more answers
PLEASE HELP ASAP!!!!!!!!!!!
Bingel [31]

Answer:

True

Explanation:

3 0
2 years ago
Read 2 more answers
Steps of booting a computer
Lostsunrise [7]
Steps of Booting
The Startup. It is the first step that involves switching the power ON. ...
BIOS: Power On Self Test. It is an initial test performed by the BIOS. ...
Loading of OS. In this step, the operating system is loaded into the main memory. ...
System Configuration. ...
Loading System Utilities. ...
User Authentication.
8 0
2 years ago
Other questions:
  • Which of the following savings vehicles usually requires a high minimum balance
    14·1 answer
  • What will the output be from the following program?
    5·1 answer
  • A tracking signal A. is computed as the mean absolute deviation​ (MAD) divided by the running sum of the forecast errors​ (RSFE)
    10·1 answer
  • QUESTION 16
    14·1 answer
  • 2. Which Interface uses
    7·1 answer
  • What is a computer and what is the work of it​
    5·2 answers
  • Why computer literacy is vital to access in business work
    7·1 answer
  • Explain how the CPU processes data instructions.
    6·1 answer
  • Seneca has just applied conditional formatting and realizes that she has made a mistake. Which action should she take to fix the
    12·2 answers
  • The equals method of the Object class returns true only if the two objects being compared:_________
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!