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
Who the heck is bts?!?!!!???​
Lana71 [14]

Answer:

they are a k-pop boy band.

6 0
2 years ago
Read 2 more answers
What is a mixer? BTW NOT just any mixer....a mixer in music<br> THis is for tech theater class
ASHA 777 [7]

Answer:

it changes the level of music, such as bass level or sweter level

6 0
3 years ago
Plz help me i need it asap
Ulleksa [173]

Voyager

Shortly after the Pioneers made their flybys, the Voyager1 and Voyager 2 probes followed. They made many important discoveries aboutJupiter and Saturn, including rings around Jupiter and the presence ofvolcanism on Jupiter's moon, Io. Voyager went on to make the first flybys ofUranus, where it discovered 10 new moons, and Neptune, where it found thatNeptune actually weighs less than astronomers thought. Both Voyager crafts have enough power to keep transmitting radio signals until at least 2025, and are now exploring the very edge of the solar system and beginning of interstellar space. Voyager 2 is currently the farthest man-made object from Earth, at more than a hundred times the distance from the Earth to the sun, and more than twice as far as Pluto.

I hope this helps chu

4 0
3 years ago
Differentiate between symmetric and asymmetric encryption
Shalnov [3]

Answer:

While symmetric encryption uses a single shared key to encrypt and decrypt data, asymmetric uses two separate keys

8 0
1 year ago
Read 2 more answers
Create a new folder in python and make it read only
igor_vitrenko [27]
Making the file read-only will not allow the file to be rewritten again. For this, we need to modify the permissions of the file. To achieve this, we will make use of the os module in Python more specifically, the chmod() of the os module.

The coding part is extremely simple and will contain very few lines as we are not doing much but changing the permissions. Using the chmod(), we can change the mode of the path, setting it to any mode using the suitable flags from the stat module. Both these modules come inbuilt with Python and hence you need not install anything additionally.

The entire code to change the file to read-only is as follows;

import os
from stat import S_IREAD
# Replace the first parameter with your file name
os.chmod("sample.txt", S_IREAD)
.

You can verify if the code was executed correctly by checking the file’s permissions. To do that :

Right-click on the file and click properties.
Under the attributes section, you will find the read-only checkbox checked.
I hope you found this article useful and it helped you make a file read-only. You can do more than just making the file read-only by using the appropriate flag from the stat module.
8 0
2 years ago
Other questions:
  • If a router receives a packet and it does not have an entry in its routing table for the destination network, it will send the p
    13·1 answer
  • What is the rationale behind the development of an operating system in computing?
    15·1 answer
  • In statistics the mode of a set of values is the value that occurs most often. Write a program that determines how many pieces o
    10·1 answer
  • Suppose you are given a text file. Design a Python3 program to encrypt/decrypt that text file as follows:
    14·1 answer
  • A reflexive pronoun is a pronoun
    6·1 answer
  • Which of the following BEST describes the relationship between the Boston Marathon bombing and biometrics?
    11·1 answer
  • A presentation software that is used to organize and present pertinent information using graphics, word processing, outlining, d
    12·1 answer
  • Which of these is not an example of a transition
    6·1 answer
  • Which terms represent the two types of client requirements?
    7·2 answers
  • 20 POINTS! Which music making software is better? Ableton Live or Logic Pro? Name the advantages and disadvantages of each one!
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!