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
A two-dimensional array of characters can contain Group of answer choices
Ber [7]

Answer: All of these.

Explanation:   Lets take a two-dimensional array alphabet[4][4]

Lets say this array contains the following elements: Example 1

a b c d

l  i  o  n

f e  l   l

s t  e  m

These are the strings with same length. So this 2D array can contain strings of same length.

Now lets take another 2D array Example 2

a b c

h  i  n  t

s  o

e g  g

2D array can have all these above mentioned elements. So it can contain strings of different lengths.

Now consider the Example 2. Some places for the elements are left. This isn't an issue for 2D array. So it can contain uninitialized elements too.

So the answer is All of above.

6 0
3 years ago
All of the following are the four more widely social media networks discussed in the text EXCEPT:
Elan Coil [88]
The answer is E) Groupon
8 0
3 years ago
Read 2 more answers
Suppose list1 is an MyArrayList and list2 is a MyLinkedList. Both contains 1 million double values. Analyze the following code:
hjlf

Answer:

The correct answer for the given question is " The Code fragment A runs fastly than the code fragment of B".

Explanation:

In this question there are some information is missing i. e options. The question does not give any options. The options for the given question is given below

(A.) The Code fragment A runs fastly than the code fragment of B.

(B.) The Code fragment B runs fastly than code fragment of  A.

(C)  The Code fragment A runs as fastly as code fragment of B.  

So we conclude the answer i.e option(A) because As given in the question list1  is a MyArrayList and list2 is a MyLinkedList.  , in list1 we fetching the data easily and fastly means that it remove the data easily as compare to list2 As MyArrayList is storing the list only and also we can fetch the data easily manner.

The list2 is an object of MyLinkedList means that it manipulating the data fastly as compared to MyArrayList but if we compared the fetching of data then  MyArrayList is a better option so the code fragment runs fastly then code fragmented B.

7 0
3 years ago
What is an compiler?
marissa [1.9K]
The accurate answer is

A compiler takes your source code, it converts the entire thing into machine language and then stores these equivalent machine language instructions in a separate file. We programmers call that the "executable file.

Glad to help :)<span />
6 0
3 years ago
Read 2 more answers
Swapping two numbers
Tju [1.3M]

Answer:

Swapping two numbers means exchange the values of two variables with each other.

8 0
3 years ago
Other questions:
  • A company decides to create static design diagrams for an upcoming project. Which statement correctly describes the attribute of
    6·1 answer
  • This is a free point thing!! I am giving 100 points!! Anyone wanna talk!!!!
    11·2 answers
  • Complex communication skills will probably never be outsourced to a computer because they require the human touch.
    8·1 answer
  • Describe the major research, discoveries, or impact Timothy Berners-Lee has made on the scientific community. 100 points for ans
    6·1 answer
  • What is the best temperature to set your air conditioner on?
    12·1 answer
  • Each computer on a network requires a unique way to identify itself and to refer to other computers. This is accomplished by usi
    8·1 answer
  • A healthcare organization received notification that a hospital employee’s laptop that contained PHI was inadvertently left at a
    14·1 answer
  • Write a program that asks the user to enter two integer numbers X and Y. The program halves each number between X and Y then pri
    15·1 answer
  • Karin realized that a song takes up a lot more space on her computer than the lyrics of the song typed out in ms word document .
    12·1 answer
  • 1. why is manufacturing considered the biggest contributor to progress
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!