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 list is sorted by selecting the largest element in the list and swapping it with the last one. This technique is called ______
ratelena [41]
Selection sort is the answer
4 0
3 years ago
Write a SELECT statement that returns one row for each customer that has orders with these columns:
d1i1m1o1n [39]

Answer:

SELECT email_address,

SUM(item_price * Quantity) AS item_price_total,

SUM(discount_amount * Quantity) AS discount_amount_total

FROM Customers c

JOIN Orders o ON c.CustomerID = o.CustomerID

JOIN Order_Items oi ON o.OrderID = oi.OrderID

GROUP BY email_address

ORDER BY item_price_total DESC

Explanation:

In this SQL statement the SELECT statement selects the following columns:

email_address

item_price

Quantity

discount_amount

There are two tables Customers and Order_Items

SUM aggregate function is used to add the values of the product of the columns discount_amount and Quantity. It is also used to get the sum of the product of two columns discount_amount and Quantity.

A new temporary column named item_price_total is used to name the sum of the product of two columns discount_amount and Quantity using AS which is ALIAS and it is used to give a name to some columns or a table.

Similarly discount_amount_total name is given to the column which calculate the sum of the product of two columns i.e. discount_amount and Quantity.

JOIN is used here to join the columns from the tables Order_items and Customers.

GROUP BY is used to group the result of rows and is used with functions like SUM. Here the rows are grouped by the email address.

ORDER BY is used to order the result. Here the result is ordered by item_price_total in descending  order.

This SELECT statement can also be written as following:

SELECT c.email_address,

SUM(o.item_price * o.Quantity),

SUM(o.discount_amount * o.quantity)

FROM customer c

JOIN Order_Items o ON o.id = c.id

GROUP BY c.email_address

7 0
3 years ago
Which type of data is is usually collected as numerical data that can be presented in a graph or chart?
Natali5045456 [20]

Answer:

Quantitative data

Explanation:

Quantitative data is information about quantities; that is, information that can be measured and written down with numbers. Some other aspects to consider about quantitative data: Focuses on numbers. Can be displayed through graphs, charts, tables, and maps.

8 0
2 years ago
Controlling inflation is the job of the __________________.
n200080 [17]
B. Federal Reserve................
8 0
3 years ago
Read 2 more answers
Required skills,training,education for dentist
AlekseyPX

Answer:

Education-Bachelor's degree prior to admission to dental school; doctoral degree in dental medicine or dental surgery; some dental specializations require completion of a residency

Skills- Communication skills. Dentists must have excellent communication skills, Detail oriented, Dexterity, Leadership skills, Organizational skills, Patience, Physical stamina, Problem-solving skills.

Explanation:

7 0
2 years ago
Other questions:
  • The following 2D array has been created:
    12·2 answers
  • It proceeds the statement causes execution of the current loop iteration to end and commence at the beginning of the next loop.
    10·1 answer
  • Full form of SMPT???
    15·1 answer
  • Contextual targeting method mean
    11·1 answer
  • What does the word "e-business" mean?
    11·2 answers
  • What does Putting a word in quotation marks on your search bar do on google?
    12·1 answer
  • Match the job roles with their appropriate qualifications. business analyst multimedia artist network and computer systems admin
    9·2 answers
  • Write the use of these computers.
    14·1 answer
  • What are the data type(s) will be used to declare the variable(s) needed to
    9·1 answer
  • which server edition doesn't support any server roles that you would typically use with standard version
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!