Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel 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
code in java pls
Summary: Given integer values for red, green, and blue, subtract the gray from each value.
Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray).
Given values for red, green, and blue, remove the gray part.
Ex: If the input is:
130 50 130
the output is:
80 0 80
Find the smallest value, and then subtract it from all three values, thus removing the gray.
If we assume that ptr is a reference to an integer, and we add 4 to it, what will happen?
Matlab P rogram
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
- Write a program in MATLAB that receives an n * (n + 1) matrix and calculates and prints the output of the system of this matrix by using the LU decomposition method. Hint:(without using lu command)arrow_forwardPlease help me find the code for these problems in MATLAB.arrow_forwardin matlab please I am having troublearrow_forward
- Plot on matlabarrow_forwardHello! I have a comp. science quiz coming up in a few days, so I thought I would make a study guide for myself. Just wondering if someone could fill it out so that I know I'm not memorizing incorrect answers?arrow_forwardPlease help me find codes for these problems in MATLAB. Use command window only.arrow_forward
- Q/ Create afactorial function in matlab with the following equation : X² x³ Y=X+ + 4! 91 + X 4 161. + mm narrow_forwardShow how the letters A, B, and C can be turned into decimal numbers. A.arrow_forwardBirth year Life expectancy Birth year Life expectancy 1900 48.3 1960 66.6 1910 51.1 1970 67.1 1920 55.2 1980 70.0 1930 57.4 1990 71.8 1940 62.5 2000 73.0 1950 65.6 Life expectancy improved dramatically in the 20th century. The table gives the life expectancy at birth (in years) of males born in the United States. Use a scatter plot (in matlab)to choose an appropriate type of model. Use your model to predict the life- span of a male born in the year 2010. USING MATLAB!arrow_forward
- In MATLABarrow_forwardFind the root of tg(x)=1/2which is between x=0.6 and x=0.7. Use Newton Raphson's method (if it is possible to make a code in matlab)and start calculations with x=0.6.Thanks in advancearrow_forwardWrite a program in Java Object Oriented language that performs Addition, Subtraction, Multiplication and Division of two fractions.arrow_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