Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134700144
Author: Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 4.2, Problem 4.2.7CP
Program Plan Intro
Mathematical functions:
- The “Math” class in the Java provides many useful methods for performing common mathematical functions.
- The “Math” class can be categorized as an exponent methods, trigonometric methods and service methods.
- The “Math” class also provides two “double” constants, “PI” and “E”.
Trigonometric method:
Trigonometric method consists of eight methods. They are:
- sin (randians) – it will return the sine of an angle in radians
- asin (a) – it will return the angle in radians for the inverse of sine
Exponent method:
Exponent methods consist of five methods. They are:
exp (x) – it will return “e” raised to power of “x”.
log (x) – it will return the natural logarithm of “x”
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Matlab P rogram
ytr
1. Determine |A|, where:
{z}
b. A = {{z}}
_d. A = {z, {z}, {z, {z}}}
_e. A = P({z})
_f. A = P({Ø,z})
a. A =
_c. A = {z, {z}}
Chapter 4 Solutions
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
Ch. 4.2 - Evalute the following method calls: (a)...Ch. 4.2 - True or false? The argument for trigonometric...Ch. 4.2 - Write a statement that converts 47 degrees to...Ch. 4.2 - Write a statement that converts PI to an angle in...Ch. 4.2 - Write an expression that obtains a random integer...Ch. 4.2 - Prob. 4.2.6CPCh. 4.2 - Prob. 4.2.7CPCh. 4.3 - Use print statements to find out the ASCII code...Ch. 4.3 - Which of the following are correct literals for...Ch. 4.3 - How do you display the characters \ and "?
Ch. 4.3 - Evaluate the following: Int i = '1'; int j ='1' +...Ch. 4.3 - Can the following conversions involving casting be...Ch. 4.3 - Show the output of the following program: public...Ch. 4.3 - Write the code that generates a random lowercase...Ch. 4.3 - Show the output of the following statements:...Ch. 4.4 - Suppose s1, s2, and s3 are three strings, given as...Ch. 4.4 - Prob. 4.4.2CPCh. 4.4 - Show the output of the following statements (write...Ch. 4.4 - Prob. 4.4.4CPCh. 4.4 - Let s1 be " Welcome " and s2 be " welcome ". Write...Ch. 4.4 - Write one statement to return the number of digits...Ch. 4.4 - Write one statement to return the number of digits...Ch. 4.5 - If you run Listing 4.3 GuessBirthday.java with...Ch. 4.5 - If you enter a lowercase letter such as b, the...Ch. 4.5 - What would be wrong if lines 6 and 7 are in...Ch. 4.6 - Prob. 4.6.1CPCh. 4.6 - Prob. 4.6.2CPCh. 4.6 - Show the output of the following statements: (a)...Ch. 4 - (Geometry: area of a pentagon) Write a program...Ch. 4 - (Geometry: great circle distance) The great circle...Ch. 4 - (Geography: estimate areas) Use the GPS locations...Ch. 4 - (Geometry: area of a hexagon) The area of a...Ch. 4 - (Geometry: area of a regular polygon) A regular...Ch. 4 - (Random points on a circle) Write a program that...Ch. 4 - (Corner point coordinates) Suppose a pentagon is...Ch. 4 - (Find the character of an ASCII code) Write a...Ch. 4 - (Find the Unicode of a character) Write a program...Ch. 4 - (Guess birthday) Rewrite Listing 4.3,...Ch. 4 - (Decimal to hex) Write a program that prompts the...Ch. 4 - (Hex to binary) Write a program that prompts the...Ch. 4 - (Vowel or consonant?) Write a program that prompts...Ch. 4 - (Convert Letter grade to number) Write a program...Ch. 4 - (Phone key pads) The international standard...Ch. 4 - (Random character) Write a program that displays a...Ch. 4 - (Days of a month) Write a program that prompts the...Ch. 4 - (Student major and status) Write a program that...Ch. 4 - (Business: check ISBN-10) Rewrite Programming...Ch. 4 - (Process a string) Write a program that prompts...Ch. 4 - (Check SSN) Write a program that prompts the user...Ch. 4 - (Check substring) Write a program that prompts the...Ch. 4 - 23 (Financial application: payroll) Write a...Ch. 4 - (Order three cities) Write a program that prompts...Ch. 4 - (Generate vehicle plate numbers) Assume that a...Ch. 4 - (Financial application: monetary units) Rewrite...
Knowledge Booster
Similar questions
- c++ computer language randomly generates integers in the interval [1,10] a.1+rand()%11 b.rand()%11 c.rand()%10 d.1+rand()%10arrow_forwardFactorial of a number is defined as: n! = n(n-1)(n-2)(n-3)...(2)(1) For example, 4! = 4*3*2*1 The n! can be written in terms of (n-1)! as: n! = n* (n-1)! (n-1)! = (n-1)*(n-2) ! and so forth. Thus, in order to compute n!, we need (n-1)!, to have (n-1)!, we need (n-2)! and so forth. As you may immediately notice, the base case for factorial is 1 because 1! = 1. Write a program that uses a recursive function called factorial that takes an integer n as its argument and returns n! to the main. C++ PLEASEarrow_forwardAnswer in java language only A very successful cinema director named "Chef" decided to solve the problem. When a customer wants to buy a ticket, the clerk at the ticket window asks the visitor if he or she needs a rest area, and if so, which one: left, right, or both. We know that in the audience they are expected to appear, their L needs a left-handed position, their R needs a right one, Z does not need a single one and B needs both. Your job is to count the number of people who can attend the show. In the theatre there are N rows with each M seat. There is only one lounge between the two adjacent seats. Seats at the beginning and end of the row have two armrests. Input 1 331209 Output: 8arrow_forward
- Write a program in Java Object Oriented language that performs Addition, Subtraction, Multiplication and Division of two fractions.arrow_forwardjava-matlabarrow_forwardAssignment Write a program that calculates the revenue of a trip of a train composed of several train-cars. For the train, the user will give the total allowed train- car count (int), total allowed weight (double), and base speed (double). Then, the user will give train-car information for ALL train-cars that will TRY TO BE ADDED to the train. First, the number of train-cars will be given (int). For each train-car, three information will be given: type of the cargo (std:string), weight of the train-car (double), and how full the train-car is (int). After getting all this information, the program will TRY TO ADD each train-car to the train according to the train-car count and total allowed weight values. You CANNOT ADD a train-car to a train if it exceeds its train-car count. You CANNOT ADD a train-car to a train if by adding this train-car, the total weight of the train exceeds the train's total allowed weight. Each added train-car reduces the speed of the train by half its weight.…arrow_forward
- ANSWER IN PYTHON. THIS IS A CODING PROBLEM.arrow_forwardDo fast please.arrow_forwardUsing C language, trace this: void trace(int x, int *y, int z) {x = 1; *y=2;z=4;printf("%2d %2d %2d\n", x, *y, z);}main() {int x=1, y=3,z=4;clrscr();printf("%2d %2d %2d\n",x,y,z);trace(y,&x,z);printf("%2d %2d %2d\n",x,y,z);trace(x,&z,y);printf("%2d %2d %2d\n",x,y,z);trace(z,&y,x);printf("%2d %2d %2d\n",x,y,z);getch();return 0; }(c)#include<sarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr