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
Textbook Question
Chapter 2.17, Problem 2.17.1CP
Show the output of Listing 2.10 with the input value 1.99.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
the output for all of them are in correct
it should be
printSub1 will print "a", "ab", "abc", "abcd", "b", "bc", "bcd", "c", "cd", "d"
printSub2 will print "d", "cd", "bcd", "abcd", "c", "bc", "abc", "b", "ab", "a"
printSub3 will print "a", "b", "c", "d", "ab", "bc", "cd", "abc", "bcd", "abcd"
printSub4 will print "abcd", "bcd", "abc", "cd", "bc", "ab", "d", "c", "b", "a"
Note that the actual output will not have quotation marks around the substrings. The substrings must print in the order shown for each method. You may only use these String methods in your work: length(), substring()
AND ALSO THE OUTPUT SHOULD BE IN ORDER
The meaning of "invalid input" is?
Python please:
Write a program that takes a 12-hour formatted input with AM or PM and updates it to the 24-hour formatted time:
If the time is between 12:00:00 AM and 12:59:59 AM, the time should be 00:00:00 and 00:59:59.
If the time is between 01:00:00 AM and 11:59:59 AM, the time should be as is but without AM.
If the time is between 12:00:00 PM and 12:59:59 PM, the time should be as is but without PM.
If the time is between 01:00:00 PM and 11:59:59 PM, the time should have 12 added to it.
Note: Here, the minutes and seconds stay as is; only the hour part changes.
For example, if the input is
12:05:33 AM
the output is
00:05:33 is the 24-hour formatted time of 12:05:33 AM
Chapter 2 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 2.2 - Identify and fix the errors in the following code:...Ch. 2.3 - How do you write a statement to let the user enter...Ch. 2.3 - Prob. 2.3.2CPCh. 2.4 - Prob. 2.4.1CPCh. 2.5 - Identify and fix the errors in the following code:...Ch. 2.6 - Identify and fix the errors in the following code:...Ch. 2.7 - Prob. 2.7.1CPCh. 2.8 - Prob. 2.8.1CPCh. 2.8 - Translate the following algorithm into Java code:...Ch. 2.9 - Prob. 2.9.1CP
Ch. 2.9 - Prob. 2.9.2CPCh. 2.9 - Prob. 2.9.3CPCh. 2.9 - Prob. 2.9.4CPCh. 2.9 - Prob. 2.9.5CPCh. 2.9 - Prob. 2.9.6CPCh. 2.9 - Write a statement to display the result of 23.5.Ch. 2.9 - Suppose m and r are integers. Write a Java...Ch. 2.10 - How many accurate digits are stored in a f1oat or...Ch. 2.10 - Prob. 2.10.2CPCh. 2.10 - Prob. 2.10.3CPCh. 2.10 - Which of the following are correct literals?...Ch. 2.11 - How would you write the following arithmetic...Ch. 2.12 - Prob. 2.12.1CPCh. 2.13 - Prob. 2.13.1CPCh. 2.14 - Which of these statements are true? a. Any...Ch. 2.14 - Show the output of the following code: int a = 6;...Ch. 2.15 - Prob. 2.15.1CPCh. 2.15 - Prob. 2.15.2CPCh. 2.15 - Show the following output: float f =12.5F; int i =...Ch. 2.15 - If you change (int) (tax 100) / 100.0 to (int)...Ch. 2.15 - Prob. 2.15.5CPCh. 2.15 - Write an expression that rounds up a double value...Ch. 2.16 - How would you write the following arithmetic...Ch. 2.17 - Show the output of Listing 2.10 with the input...Ch. 2.18 - Can you declare a variable as int and later...Ch. 2.18 - Prob. 2.18.2CPCh. 2.18 - Will overflow cause a runtime error?Ch. 2.18 - Prob. 2.18.4CPCh. 2 - (Convert Celsius to Fahrenheit) Write a program...Ch. 2 - (Compute the volume of a cylinder) Write a program...Ch. 2 - (Convert feet into meters) Write a program that...Ch. 2 - (Convert pounds into kilograms) Write a program...Ch. 2 - (Financial application: calculate tips) Write a...Ch. 2 - (Sum the digits in an integer) Write a program...Ch. 2 - (Find the number of years) Write a program that...Ch. 2 - (Current time) Listing 2.7. ShowCurrentTime.java,...Ch. 2 - (Physics: acceleration) Average acceleration is...Ch. 2 - (Science: calculating energy) Write a program that...Ch. 2 - (Population projection) Rewrite Programming...Ch. 2 - (Physics: finding runway length) Given an...Ch. 2 - (Financial application: compound value) Suppose...Ch. 2 - (Health application: computing BMI) Body Mass...Ch. 2 - (Geometry: distance of two points) Write a program...Ch. 2 - (Geometry: area of a hexagon) Write a program that...Ch. 2 - (Science: wind-chill temperature) How cold is it...Ch. 2 - (Print a table) Write a program that displays the...Ch. 2 - (Geometry: area of a triangle) Write a program...Ch. 2 - (Financial application: calculate interest) If you...Ch. 2 - (Financial application: calculate future...Ch. 2 - (Financial application: monetary units) Rewrite...Ch. 2 - (Cost of driving) Write a program that prompts the...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Alphabetic Telephone Number Translator Many companies use telephone numbers like 555-GET-FOOD so the number is ...
Starting out with Visual C# (4th Edition)
(Printing Numbers from a Loop) Write a program that utilizes looping to print the numbers from 1 to 10 side by ...
C How to Program (8th Edition)
We know that the first file name is stored at index zero in the ArrayList, and the list stores the file names a...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Employee Class Write a class named Employee that has the following fields: name. The name field references a St...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Software Sales Software companies often offer their customers the option to lease the software yearly or purcha...
Starting Out With Visual Basic (7th 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
- [Hard] Print the following pattern for the given input: Input: 5 Output: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Print the following pattern for the given input: Input: 5 Output: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5arrow_forwardWhat is the echo statements for the kitties, please provide the output of the kitties of the echo statements?arrow_forwardObtain the postfix expression and evaluate it from the given infix expression 9+5/5+9*7arrow_forward
- Fix the codearrow_forward1. Input two integer values. The first one shall accept any integer from 0-9 and the other one shall take a non-zero positive integer. 2. Using a while loop, count how many of the first integer (0-9) is present in the digits of the second inputted integer and print the result (see sample input and output for example). 3. Tip #1: You have to use your knowledge from the previous problems in looping through the digits of a number: % 10 to get the rightmost digit, while / 10 to remove the rightmost digit. Make sure to solve the previous problems first. Instructions 1. Create two variables assigned to an input() function. The first one shall accept any integer from 0-9 and the other one shall take a random positive integer. All the needed values are to be inputted in one single line. 2. Using a while loop, count how many of the first integer (0-9) is present in the digits of the second inputted integer and print the result (see sample input and output for example). Input A line containing…arrow_forwardWhat is the output of the following Pep/9 code, if the input is 5, 9, 6, -12, 7, 14. Properly comment the progtram and explain the purpose. BR main number: .EQUATE 6 j: .EQUATE 4 amount: .EQUATE 2 result: .EQUATE O main: SUBSP 8, i DECI number, s LDWA 0, i STWA result, s LDWA 1, i STWA j, s for: CPWA number, s BRGT endFor DECI amount, s LDWA amount, s ADDA result, s STWA result, s LDWA j, s ADDA 1, i STWA j, s BR for endFor: STRO msg, d DECO result, s LDBA In', i STBA charout, d ADDSP 8, i STOP msg: .ASCII "Result = \x00" .ENDarrow_forward
- Take two time inputs from a user. And tell the differences between the time. Sample output Enter hours minutes and seconds: 11 33 34 Enter hours minutes and seconds : 8 12 15 Time difference: 3 : 21 : 19arrow_forwardSource Code 12 * @author 13 * @version ackage 14 */ 15 public class TotalAndOut0fRangeCounts 16 public static void main(String[] args) 17 18 final int LOW_LIMIT 19 = 20; final int HIGH_LIMIT = 40; 20 21 Scanner in= new Scanner (System.in); 22 23 // Step 2: Declare variables for the two counts // 24 25 with initial values 26 27 // Step 3: Display the input prompt 28 // "Enter an integer or Q to quit: 29 30 31 // Step 4: While the input is an integer // 32 Read the integer 33 Update the total count If the input integer is out of the range Update the out of range count Prompt for the next input using the same prompt 34 // 35 36 // ne. // 37 38 savedarrow_forwardPlease show the outputarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Boolean Algebra - Digital Logic and Logic Families - Industrial Electronics; Author: Ekeeda;https://www.youtube.com/watch?v=u7XnJos-_Hs;License: Standard YouTube License, CC-BY
Boolean Algebra 1 – The Laws of Boolean Algebra; Author: Computer Science;https://www.youtube.com/watch?v=EPJf4owqwdA;License: Standard Youtube License