BIG JAVA: LATE OBJECTS
2nd Edition
ISBN: 9781119626220
Author: Horstmann
Publisher: WILEY
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 5.1, Problem 3SC
The Math.ceil method in the Java standard library is described as follows: The method receives a single argument a of type double and returns the smallest double value ≥ a that is an integer. What is the return value of Math.ceil(2.3)?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Language:Java
- Requests two double values from the user and stores them in local variables in main() - Create a method which takes these two values as parameters- The method will use Math library functions to:
o Print the square root of the 1st parametero Print the log of the 2nd parametero Print the value of the 1st parameter raised to the power of the 2nd parameter
basic java please
Write a method called findTip that finds the value of a meal as a double after adding the tip to the cost. Then return this value to the calling function.
For example findTip(120.10, 5) would 126.105 because that is a 5% tip. While findTip(48.0, 15) would return 55.2 because that is a 15% tip.
Note that the bill is a double while the tip is an int.
Don’t worry about rounding to two decimal places, just return the full value as a double.
basic java please
Write a method dominant that accepts three integers as parameters and returns true if any one of the three integers is larger than the sum of the other two integers, otherwise it returns false.
The integers might be passed in any order, so the largest value could be any of the three. If no value is larger than the sum of the other two, your method should return false.
For example, the call of dominant(4, 9, 2) would return true because 9 is larger than 4 + 2. The call of dominant(5, 3, 7) would return false because none of those three numbers is larger than the sum of the others.
Chapter 5 Solutions
BIG JAVA: LATE OBJECTS
Ch. 5.1 - Consider the method call Math.pow(3, 2). What are...Ch. 5.1 - What is the return value of the method call...Ch. 5.1 - The Math.ceil method in the Java standard library...Ch. 5.1 - It is possible to determine the answer to Self...Ch. 5.2 - What is the value of cubeVolume(3)?Ch. 5.2 - Prob. 6SCCh. 5.2 - Provide an alternate implementation of the body of...Ch. 5.2 - Declare a method squareArea that computes the area...Ch. 5.2 - Consider this method: public static int...Ch. 5.3 - What does this program print? Use a diagram like...
Ch. 5.3 - Prob. 11SCCh. 5.3 - What does this program print? Use a diagram like...Ch. 5.4 - Prob. 13SCCh. 5.4 - What does this method do? public static boolean...Ch. 5.4 - Implement the mystery method of Self Check 14 with...Ch. 5.5 - How do you generate the following printout, using...Ch. 5.5 - Prob. 17SCCh. 5.5 - Prob. 18SCCh. 5.5 - Prob. 19SCCh. 5.5 - The boxString method contains the code for...Ch. 5.6 - Consider the following statements: int...Ch. 5.6 - Consider this method that prints a page number on...Ch. 5.6 - Consider the following method that computes...Ch. 5.6 - The comment explains what the following loop does....Ch. 5.6 - In Self Check 24, you were asked to implement a...Ch. 5.7 - Explain how you can improve the intName method so...Ch. 5.7 - Prob. 27SCCh. 5.7 - What happens when you call intName(0)? How can you...Ch. 5.7 - Trace the method call intName(72), as described in...Ch. 5.7 - Prob. 30SCCh. 5.8 - Which lines are in the scope of the variable i...Ch. 5.8 - Which lines are in the scope of the parameter...Ch. 5.8 - The program declares two local variables with the...Ch. 5.8 - There is a scope error in the mystery method. How...Ch. 5.8 - Prob. 35SCCh. 5.9 - Consider this slight modification of the...Ch. 5.9 - Consider this recursive method: public static int...Ch. 5.9 - Consider this recursive method: public static int...Ch. 5.9 - Prob. 39SCCh. 5.9 - The intName method in Section 5.7 accepted...Ch. 5 - In which sequence are the lines of the Cubes.java...Ch. 5 - Write method headers for methods with the...Ch. 5 - Give examples of the following methods from the...Ch. 5 - Prob. 4RECh. 5 - Consider these methods: public static double...Ch. 5 - Prob. 6RECh. 5 - Design a method that prints a floating-point...Ch. 5 - Write pseudocode for a method that translates a...Ch. 5 - Describe the scope error in the following program...Ch. 5 - For each of the variables in the following...Ch. 5 - Prob. 11RECh. 5 - Perform a walkthrough of the intName method with...Ch. 5 - Consider the following method: public static int...Ch. 5 - Consider the following method that is intended to...Ch. 5 - Suppose an ancient civilization had constructed...Ch. 5 - Give pseudocode for a recursive method for...Ch. 5 - Give pseudocode for a recursive method that sorts...Ch. 5 - Write the following methods and provide a program...Ch. 5 - Write the following methods and provide a program...Ch. 5 - Prob. 4PECh. 5 - Prob. 5PECh. 5 - Prob. 6PECh. 5 - Prob. 7PECh. 5 - Prob. 8PECh. 5 - Write methods public static double...Ch. 5 - Write a recursive method public static String...Ch. 5 - Write a recursive method public static boolean...Ch. 5 - Use recursion to implement a method public static...Ch. 5 - Use recursion to determine the number of digits in...Ch. 5 - Write a method that computes the balance of a bank...Ch. 5 - Write a method that tests whether a file name...Ch. 5 - It is a well-known phenomenon that most people are...Ch. 5 - Prob. 3PPCh. 5 - Use recursion to compute an, where n is a positive...Ch. 5 - Leap years. Write a method public static boolean...Ch. 5 - In Exercise P3.13 you were asked to write a...Ch. 5 - Prob. 10PPCh. 5 - Write a program that reads two strings containing...Ch. 5 - Prob. 12PPCh. 5 - Write a program that reads words and arranges them...Ch. 5 - Prob. 14PPCh. 5 - Write a program that reads two fractions, adds...Ch. 5 - Write a program that prints the decimal expansion...Ch. 5 - Write a program that reads a decimal expansion...Ch. 5 - Write two methods public static void...Ch. 5 - Write a program that reads in the width and height...Ch. 5 - Repeat Exercise P5.19 with hexagonal circle...Ch. 5 - Postal bar codes. For faster sorting of letters,...Ch. 5 - Write a program that reads in a bar code (with :...Ch. 5 - Write a program that converts a Roman number such...Ch. 5 - A non-governmental organization needs a program to...Ch. 5 - Having a secure password is a very important...Ch. 5 - Prob. 30PPCh. 5 - Prob. 31PPCh. 5 - Electric wire, like that in the photo, is a...Ch. 5 - The drag force on a car is given by FD=12v2ACD...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Porter’s competitive forces model: The model is used to provide a general view about the firms, the competitors...
Management Information Systems: Managing The Digital Firm (16th Edition)
A classs responsibilities are __________. a. the objects created from the class b. things the class knows c. ac...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Today, CPUs are huge devices made of electrical and mechanical components such as vacuum tubes and switches.
Starting Out with Python (3rd Edition)
Remove the following two statements from the draw method of Picture: window.changeColorblack;sun.changeColor(ye...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
(Printing Numbers in Various Field Widths) Write a program to test the results of printing the integer value 12...
C How to Program (8th Edition)
// Assume inputFile references a Scanner object, try { input = inputFile.nextlnt(); } finally { inputFile.close...
Starting Out with Java: From Control Structures through Objects (6th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Writing Methods that Require a Single Parameter in Java In this lab, you complete a partially written Java program that includes two methods that require a single parameter. The program continuously prompts the user for an integer until the user enters 0. The program then passes the value to a method that computes the sum of all the whole numbers from 1 up to and including the entered number. Next, the program passes the value to another method that computes the product of all the whole numbers up to and including the entered number. The source code file provided for this lab includes the necessary variable declarations and the input statement. Comments are included in the file to help you write the remainder of the program. Instructions Ensure the file named SumAndProduct.java is open. Write the Java statements as indicated by the comments. Execute the program by clicking "Run Code." USE THE GIVEN CODE // SumAndProduct.java - This program computes sums and products. //…arrow_forwardTrue or False A Java method can be defined to accept a varying number of parameters.arrow_forwardPrime number is the number that is divided by one and itself only, Twin Prime is a pair of prime numbers that differ by 2. For example, 3 and 5 are twin primes, 5 and 7 are twin primes, and 11 and 13 are twin primes. Write a java program to find all twin primes within a range of 1 up to a number entered by user, such that, that the entered number should be greater than 10. The program has to have a method that takes an integer as a formal parameter and returns if that number is prime or not. Display the output as follows: Enter an integer (greater than 10): 7 Not accepted number! Enter an integer (greater than 10): 50 The number of twin prime numbers up to 50 are: (3, 5) (5, 7) (11, 13) (17, 19) (29, 31) (41, 43)arrow_forward
- a Java static method that will take an array of strings as its only parameter. The method will return the first string alphabetically (lowest) in the array.arrow_forwardJava: Outline: The main program will read in a group of three integer values which represent a student's SAT scores. The main program will call a method to determine if these three scores are all valid--valid means in the range from 200 to 800, including both end points, and is a multiple of 10 (ends in a 0). If the scores are all valid, the main program will call a method (which will itself call other methods) to classify the group of three scores in various ways. The main program will repeat this process for the entire set of data, then print some counters. Main Program:The main program will read in and print three integer values, representing SAT scores. Then the main program will call the method isitavalidgroup() to determine whether or not this group is valid. In either case, the main program will print the result of the method call (and add to the appropriate counter – discussed below). In more detail: If the method isitavalidgroup() says this is a valid group, the main program…arrow_forwardIn Java, Arrays are made up only of numbers. True or Falsearrow_forward
- In Java program,,,,,,,,,,,arrow_forwardwrite a java program A twin prime is a prime number that is either 2 less or 2 more than another prime number. For example (41, 43) are both primes and are twin primes because 41 + 2 = 43. Write a program that asks the user to enter a positive number and checks if this number is prime. If the number is prime then the program must check if it has a twin prime. So if n is prime, then n - 2 or n + 2 should be checked. The program repeats until the user enters -1. Sample Run: Enter a positive integer (-1 to end): -5 Invalid Number Enter a positive integer (-1 to end): 61 61 is prime 59 and 61 are twin prime Enter a positive integer (-1 to end): 137 137 is prime 137 and 139 are twin prime Enter a positive integer (-1 to end): 30 30 is not prime Enter a positive integer (-1 to end): 23 23 is prime 23 does not have a twin prime Enter a positive integer (-1 to end): -1arrow_forwardJava: Class: SortedNumbers Write a method for the method header below and provide a (main) program to test it: boolean sorted(double x, double y, double z), returning true if the arguments are sorted, with the smallest one coming first Remember to include the Javadoc comment for the method.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License