Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 25RE
For each of the following computations in Java, determine whether the result is exact, an overflow, or a roundoff error.
- a. 2.0 - 1.1
- b. 1.0E6 * 1.0E6
- c. 65536 * 65536
- d. 1_000_000L * 1_000_000L
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
write a program in java for converting binary numbers to decimal numbers, and conversely. [You can not use the conversion functions from the mathematical library.] Your program should do the following:
1. Ask the user if they want a Binary number converted to Decimal number, a Decimal number converted to a Binary number, or to quit the program.
2. Ask the user for the number, take the appropriate action and then print out the appropriate message.
1) Write a java program to calculate the average of five inputted real numbers from the user. Print out the results in the console to two decimal places.2) Write a java program to check which of your two friends is older. Ask for each of their date of birth. month, day, year. All in integer data types. Then print out the month, day and year of the older.
3. Fast in java coding please. Thank you
Identify errors in the following program, correct them and write theoutput.class test {public static void main(String[] args) {byte a = 200;short b = a * 6;long l = 10000;float k = 1357.24;byte c = k;double d = b;System.out.println(b);System.out.println(c);System.out.println(d);}}
Chapter 2 Solutions
Big Java Late Objects
Ch. 2.1 - Declare a variable suitable for holding the number...Ch. 2.1 - What is wrong with the following variable...Ch. 2.1 - Declare and initialize two variables, unitPrice...Ch. 2.1 - Prob. 4SCCh. 2.1 - Some drinks are sold in four-packs instead of...Ch. 2.1 - Prob. 6SCCh. 2.1 - Prob. 7SCCh. 2.1 - Prob. 8SCCh. 2.1 - How would you explain assignment using the parking...Ch. 2.2 - A bank account earns interest once per year. In...
Ch. 2.2 - In Java, how do you compute the side length of a...Ch. 2.2 - The volume of a sphere is given by V=43r3 If the...Ch. 2.2 - Prob. 13SCCh. 2.2 - Prob. 14SCCh. 2.3 - Write statements to prompt for and read the users...Ch. 2.3 - What is wrong with the following statement...Ch. 2.3 - Prob. 17SCCh. 2.3 - What is problematic about the following statement...Ch. 2.3 - What is the output of the following statement...Ch. 2.3 - Using the printf method, print the values of the...Ch. 2.4 - Prob. 21SCCh. 2.4 - Suppose the architect specifies a pattern with...Ch. 2.4 - A robot needs to tile a floor with alternating...Ch. 2.4 - For a particular car, repair and maintenance costs...Ch. 2.4 - The shape of a bottle is approximated by two...Ch. 2.5 - What is the length of the string "Java Program"?Ch. 2.5 - Consider this string variable. String str = "Java...Ch. 2.5 - Use string concatenation to turn the string...Ch. 2.5 - Prob. 29SCCh. 2.5 - Prob. 30SCCh. 2 - Write declarations for storing the following...Ch. 2 - What is the value of mystery after this sequence...Ch. 2 - What is wrong with the following sequence of...Ch. 2 - Write the following mathematical expressions in...Ch. 2 - Write the following Java expressions in...Ch. 2 - What are the values of the following expressions?...Ch. 2 - What are the values of the following expressions,...Ch. 2 - What are the values of the following expressions?...Ch. 2 - Assuming that a and b are variables of type int,...Ch. 2 - Suppose direction is an integer angle between 0...Ch. 2 - Find at least five compile-time errors in the...Ch. 2 - Find three run-time errors in the following...Ch. 2 - Consider the following code segment. double...Ch. 2 - Explain the differences between 2, 2.0, 2, 2, and...Ch. 2 - Explain what each of the following program...Ch. 2 - Write pseudocode for a program that reads a word...Ch. 2 - Write pseudocode for a program that reads a name...Ch. 2 - Write pseudocode for a program that computes the...Ch. 2 - Modify the pseudocode for the program in How To...Ch. 2 - Prob. 20RECh. 2 - You are cutting off a piece of pie like this,...Ch. 2 - The following pseudocode describes how to obtain...Ch. 2 - Suppose you are given a string str and two...Ch. 2 - Prob. 24RECh. 2 - For each of the following computations in Java,...Ch. 2 - Prob. 26RECh. 2 - This chapter contains a number of recommendations...Ch. 2 - Write a program that displays the dimensions of a...Ch. 2 - Write a program that computes and displays the...Ch. 2 - Write a program that reads a number and displays...Ch. 2 - Write a program that prompts the user for two...Ch. 2 - Enhance the output of Exercise E2.4 so that the...Ch. 2 - Write a program that prompts the user for a...Ch. 2 - Write a program that prompts the user for a radius...Ch. 2 - Write a program that asks the user for the lengths...Ch. 2 - Improve the program discussed in How To 2.1 to...Ch. 2 - Write a program that helps a person decide whether...Ch. 2 - Write a program that asks the user to input The...Ch. 2 - File names and extensions. Write a program that...Ch. 2 - Write a program that reads a number between 1,000...Ch. 2 - Write a program that reads a number between 1,000...Ch. 2 - Printing a grid. Write a program that prints the...Ch. 2 - Write a program that reads in an integer and...Ch. 2 - Write a program that reads two times in military...Ch. 2 - Writing large letters. A large letter H can be...Ch. 2 - Write a program that transforms numbers 1, 2, 3, ,...Ch. 2 - Write a program that prints a Christmas tree:...Ch. 2 - Easter Sunday is the first Sunday after the first...Ch. 2 - In this project, you will perform calculations...Ch. 2 - The following pseudocode describes how a bookstore...Ch. 2 - The following pseudocode describes how to turn a...Ch. 2 - The following pseudocode describes how to extract...Ch. 2 - Giving change. Implement a program that directs a...Ch. 2 - An online bank wants you to create a program that...Ch. 2 - A video club wants to reward its best members with...Ch. 2 - Consider the following circuit. Write a program...Ch. 2 - The dew point temperature Td can be calculated...Ch. 2 - The pipe clip temperature sensors shown here are...Ch. 2 - Prob. 12PPCh. 2 - Consider the following tuning circuit connected to...Ch. 2 - According to the Coulomb force law, the electric...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write a version of the statcheck program in Figure 10.10, called fstatcheck that takes a descriptor number on t...
Computer Systems: A Programmer's Perspective (3rd Edition)
Big data Big data describes datasets with huge volumes that are beyond the ability of typical database manageme...
Management Information Systems: Managing The Digital Firm (16th Edition)
Book Club Points Serendipity Booksellers has a book club that awards points to its customers based on the numbe...
Starting Out With Visual Basic (7th Edition)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
List four types of systems that may require software safety cases, explaining why safety cases are required.
Software Engineering (10th Edition)
What is the difference between a static stack and a dynamic stack?
Starting Out with C++: Early Objects
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
- Create a program (using Java or Python) for converting binary numbers to decimal numbers, and conversely. [You can not use the conversion functions from the mathematical library.] Your program should do the following: Ask the user if they want a Binary number converted to Decimal number, a Decimal number converted to a Binary number, or to quit the program. Ask the user for the number, take the appropriate action and then print out the appropriate message.arrow_forwardWrite Java program that print the following series of integers 1, 5, 9, 13, 17, 21, 25, . . . , 993, 997, 1001, . . . , 1997, 2001, 2005 and calculate the sum of the terms: (1 + 5 + 9 + 13 + . . . + 1997 + 2001 + 2005)arrow_forwardIn Java inputs and output values can easily be manipulated, for example when dealing with money the value should always be formatted to 2 decimals or another use is separating of words in even spaces, line breaks and etc. Your task is to prompt the user for 2 numbers one integer the other decimal and print their product in money format. The program should also take in two words delimitated by @ symbol.arrow_forward
- Java programming- Prompt the user to enter an integer n, write a program to take input value of n and print the product of first n natural numbers. Given: 0<n<15arrow_forwardGiven three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolute value of y, and the square root of (xy to the power of z). Ex: If the input is: 3.6 4.5 2.0 the output is: 12.96 1.841304610218211E11 4.5 16.2 Produce in Java language!arrow_forwardjava, write simple program use the following method: getMin: takes three integers as arguments and returns the minimum value of the three.arrow_forward
- in java pls A local pizza shop is selling a large pizza for $9.99. Given the number of pizzas to order as input, output the subtotal for the pizzas, and then output the total after applying a sales tax of 6%. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("Subtotal: %.2f\n", yourValue); Ex: If the input is: 3 the output is: Subtotal: $29.97 Total due: $31.77arrow_forwardin java First, read the first floating-point number from input. Then, read the remaining floating-point numbers while the floating-point numbers are in the range -20.0 to 20.0, both exclusive. Output the total number of floating-point numbers read in the given range. End with a newline. Ex: If the input is -14.0 -26.5 -13.0 -17.5 -18.0 -16.5 -12.5 -15.0, then the output is: Number of floating-point numbers read: 1 Note: -20.0 and 20.0 are not in the given range. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import java.util.Scanner; public class CountRead { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); doubleinputData; intcountRead; countRead=0; /* Your code goes here */ } }arrow_forwardin java Double width and integer amountCompleted are read from input. Output the following: width as a floating-point value in scientific notation, followed by "%". amountCompleted as an octal integer value, followed by "%". width as a floating-point value, followed by "%". End each output with a newline. Ex: If the input is 26.0 69, then the output is: 2.600000e+01% 105% 26.000000% 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import java.util.Scanner; public class OutputNotation { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); doublewidth; intamountCompleted; width=scnr.nextDouble(); amountCompleted=scnr.nextInt(); /* Your code goes here */ } }arrow_forward
- 2. Write a Java program that takes input an positive integer from the user and prints the largest integer but not larger than the base-2 logarithm of that number. Enter Number: 2200 Output: 11arrow_forwardplease use java and keep the solution and code very basic Q2)solve thisIndicate the exact machine-user interaction sequence for the single-line input sequence of 26 4: System.out.print("Enter two values: "); int1 = keyboard.nextint); int2 = keyboard.nextint); keyboard.nextLine; result = int1 % int2; System.out.printf("%d rem %d = %d\n", int1, int2, result); Consider the code from the previous question, reproduced below:System.out.print("Enter two values: ");int1 = keyboard.nextint);int2 = keyboard.nextint);keyboard.nextLine();result = int1 % int2;System.out.printf("%d rem %d = %d\n", int1, int2, result);The above requires some declaration statements to run. You do not need to indicate where to place each declaration, but write the statements needed for the above code to work. (Don't forget the keyboard!) Again, we reproduce the code of this Question System.out.print("Enter two values: ");int1 = keyboard.nextint);int2 = keyboard.nextint();keyboard.nextLine();result = int1 %…arrow_forward2. Write a Java program to read input a positive integer n and prints the digits of the integer n individually and separated by a space. For n = 12345. Output: 1 2 3 4 5arrow_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
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY