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
Textbook Question
Chapter 5.8, Problem 5.8.3CP
Identify and fix the errors in the following code:
- 1. public class Test {
- 2. public void main(String[] args) {
- 3. for (int i = 0; i < 10; i++);
- 4. sum += i ;
- 5.
- 6. if (I < j);
- 7. System.out.println(i)
- 8. else
- 9. System.out.println(j);
- 10.
- 11. while (j < 10);
- 12. {
- 13. j++;
- 14. }
- 15.
- 16. do {
- 17. j++;
- 18. } while (j < 10)
- 19. }
- 20. }
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Q1/ The transistor in the circat below is
specified to have ẞ in the rang 50 to
150 Find the Value of RB that results
in Saturation with an overdrive factor of at
Least 10
3
lov
1 кл
5V
RB
edit: D:\Ahmad Saeedab20 21\Lab 08.02.asm
file edit bookmarks assembler emulator math ascii codes
81 LAB 8.2: PUSHF POPF
82
83 org 188h
84
85
-CODE
86 MOU CL. 97H
82
88 LEA SI. FLGS
variables
0x
FLGS
FLCK
show a hex
0001h, 0004h, 0010h, 0040h, 0080h, 0400h, 0800h
8083h, 8086h, 0812h, 0842h, 8882h, 8482h, 0882h
Random Access Memory
89 LEA DI, FLGR
18
11 L1: MOU AX. [S1]
12
13
PUSH AX
FLGS MEM -> AX
AX
STACK MEM
0700:0117
STACK MEMPLAG REG
FLAG REG->STACK MEM
POPF
PUSHF
POP
STACK MEM -> AX
-> FLGR MEM
INC SI
INC SI
INC DI
INC DI
LOOP L1
NULL FLGS
8788:8117: 81 881
0708:0118: 88 888
0788:0119: 84 884
8788:811A: 88 888 NULL
0788:8118: 18 816 ▸
0708:011C:
8788-8115
0788
ULL Source Meme
Shorten the paragraph in one
update
C table
9
878
8788
8788
9786
0788
888 NULL
step
884
000 NULL
8288Harz
AR
BACK
0700:01251 83 883
▾
SET CF
DATA
PP
AF
ZF
SP
DF
OF
33 PLGS DU 8881H, 8884H, 0810H, 8848H, 8880H, 0400H, 0888н
34 FLGR DW 7H DUP
Control Fa
OF DF IF TF SF ZF XAF XPF x CF
8788:0126: 88 888…
Create a class named StudentRecords and add a static variable named records,
which is a list shared among all objects of the class. Then add a method named
add_record that takes a student's name as input and appends it to the shared
records list.
Chapter 5 Solutions
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
Ch. 5.2 - Prob. 5.2.1CPCh. 5.2 - How many times are the following loop bodies...Ch. 5.2 - Prob. 5.2.3CPCh. 5.3 - What is wrong if guess is initialized to 0 in line...Ch. 5.4 - Revise the code using the System. nanoTime () to...Ch. 5.5 - Prob. 5.5.1CPCh. 5.6 - Prob. 5.6.1CPCh. 5.6 - What are the differences between a while loop and...Ch. 5.7 - Do the following two loops result in the same...Ch. 5.7 - What are the three parts of a for loop control?...
Ch. 5.7 - Suppose the input is 2 3 4 5 0. What is the output...Ch. 5.7 - What does the following statement do? for ( ; ; )...Ch. 5.7 - If a variable is declared in a for loop control,...Ch. 5.7 - Convert the following for loop statement to a...Ch. 5.7 - Count the number of iterations in the following...Ch. 5.8 - Can you convert a for loop to a while loop? List...Ch. 5.8 - Can you always convert a while loop into a for...Ch. 5.8 - Identify and fix the errors in the following code:...Ch. 5.8 - Prob. 5.8.4CPCh. 5.9 - How many times is the println statement executed?...Ch. 5.9 - Show the output of the following programs. (Hint:...Ch. 5.11 - Will the program work if n1 and n2 are replaced by...Ch. 5.11 - In Listing 5.11. why is it wrong if you change the...Ch. 5.11 - In Listing 5. 11, how many times the loop body is...Ch. 5.11 - Prob. 5.11.4CPCh. 5.11 - Prob. 5.11.5CPCh. 5.12 - What is the keyword break for? What is the keyword...Ch. 5.12 - The for loop on the left is converted into the...Ch. 5.12 - Rewrite the programs TestBreak and TestContinue in...Ch. 5.12 - After the break statement in (a) is executed in...Ch. 5.13 - What happens to the program if (low high) in line...Ch. 5.14 - Simply the code in lined 27-32 using a conditional...Ch. 5 - (Count positive and negative numbers and compute...Ch. 5 - (Repeat additions) Listing 5.4,...Ch. 5 - (Conversion from kilograms to pounds) Write a...Ch. 5 - (Conversion from miles to kilometers) Write a...Ch. 5 - (Conversion from kilograms to pounds and pounds to...Ch. 5 - Prob. 5.6PECh. 5 - (Financial application: compute future tuition)...Ch. 5 - (Find the highest score) Write a program that...Ch. 5 - (Find the two highest scores) Write a program that...Ch. 5 - (Find numbers divisible by 5 and 6) Write a...Ch. 5 - (Find numbers divisible by 5 or 6, but not both)...Ch. 5 - (Find the smallest n such that n2 12,000) Use a...Ch. 5 - (Find the largest n such that n3 12,000) Use a...Ch. 5 - (Compute the greatest common divisor) Another...Ch. 5 - (Display the ASCII character table) Write a...Ch. 5 - (Find the factors of an integer) Write a program...Ch. 5 - (Display pyramid) Write a program that prompts the...Ch. 5 - (Display four patterns using Loops) Use nested...Ch. 5 - (Display numbers in a pyramid pattern) Write a...Ch. 5 - (Display prime numbers between 2 and 1,000) Modify...Ch. 5 - Prob. 5.21PECh. 5 - For the formula to compute monthly payment, see...Ch. 5 - (Demonstrate cancellation errors) A cancellation...Ch. 5 - Prob. 5.24PECh. 5 - (Compute ) You can approximate by using the...Ch. 5 - (Compute e) You can approximate e using the...Ch. 5 - (Display leap years) Write a program that displays...Ch. 5 - (Display the first days of each month) Write a...Ch. 5 - (Display calendars) Write a program that prompts...Ch. 5 - (Financial application: compound value) Suppose...Ch. 5 - (Financial application: compute CD value) Suppose...Ch. 5 - (Game: lottery) Revise Listing 3.8, Lottery.java,...Ch. 5 - (Perfect number) A positive integer is called a...Ch. 5 - (Game: scissor; rock, paper) Programming Exercise...Ch. 5 - (Summation) Write a program to compute the...Ch. 5 - (Business application: checking ISBN) Use loops to...Ch. 5 - (Decimal to binary) Write a program that prompts...Ch. 5 - (Decimal to octal) Write a program that prompts...Ch. 5 - (Financial application: find the sales amount) You...Ch. 5 - (Simulation: heads or tails) Write a program that...Ch. 5 - (Occurrence of max numbers) Write a program that...Ch. 5 - (Financial application: find the sales amount)...Ch. 5 - (Math: combinations) Write a program that displays...Ch. 5 - (Computer architecture: bit-level operations) A...Ch. 5 - (Statistics: compute mean and standard deviation)...Ch. 5 - (Reverse a string) Write a program that prompts...Ch. 5 - (Business: check ISBN-13) ISBN -13 is a new...Ch. 5 - (Process string) Write a program that prompts the...Ch. 5 - (Count vowels and consonants) Assume that the...Ch. 5 - Prob. 5.50PECh. 5 - (Longest common prefix) Write a program that...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
How would you calculate or estimate Tm for a horizontal bandsaw cutting a 3-in. round of 1040 steel.
Degarmo's Materials And Processes In Manufacturing
In what year was Plankalkl designed? In what year was that design published?
Concepts Of Programming Languages
Write statements that assign random integers to the variable n in the following ranges: 1 1n2. 2 1n100. 3 0n9. ...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
What is the output produced by the following lines of program code? int quotient = 7/3; int reminder = 7/3; Sys...
Java: An Introduction to Problem Solving and Programming (8th Edition)
CONCEPT QUESTIONS
15.CQ3 The ball rolls without slipping on the fixed surface as shown. What is the direction ...
Vector Mechanics for Engineers: Statics and Dynamics
How Much Insurance? Many financial experts advise that property owners should insure their homes or buildings f...
Starting Out with Python (4th 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
- Subject: Database management system Explain in easy way with write handwritten note Test if the following schedule is conflict serializable or not and explain R1 (A), R2 (D), W1 (B), R2 (B), W3 (B), R4 (B), W2 (C), R5 (C), W4 (E), R5 (E), W5 (B).arrow_forwardSubject: Database management system Explain in easy way with write handwritten note Test if the following schedule is conflict serializable or not and explain R1 (A), R2 (D), W1 (B), R2 (B), W3 (B), R4 (B), W2 (C), R5 (C), W4 (E), R5 (E), W5 (B).arrow_forwardSubject: Database management system Explain in easy way with write handwritten note a. What is lossy decomposition? Check whether the following decompositions are lossy or lossless. (i) Let R=ABCD, R1 = AD, R2 = AB, R3 = BE, R4 = CDE, R5 = AE, F={ A->C, B- >C, C->D, DE->C, CE->A} (ii) R (XYZWQ), FD= {X->Z, Y->Z, Z->W, WQ->Z, ZQ-> X, R1 (XW), R2 (XY), R3 (YQ) , R4 (ZWQ), R5 (XQ) b. Eliminate redundant FDs from (i) F={X->Y, Y->X, Y->Z, Z->Y, X->Z, Z->X} (ii) F = {X->YZ, ZW->P, P->Z, W->XPQ, XYQ, YW, WQ ->YZ}arrow_forward
- Subject: DBMS Explain in easy way and do not use chatgpt A database is being constructed to keep track of the teams and games of a sports league. A team has a number of players, not all of whom participate in each game. It is desired to keep track of the players participating in each game for each team, the positions they played in that game, and the result of the game. Design an ER schema diagram for this application, stating any assumptions you make. Choose your favorite sport (e.g., soccer, baseball, football).arrow_forwardhelp with this pleasearrow_forwardFor the control system plot root Locus and find the D gain of stability? by Matlab Ris Kp (5+3) S+5 (s+1) +CUST s(S+2) (565+18) 5-1 5²+35+4arrow_forward
- CIS 115 Introduction to C++ May I please have a written review expressing my gratitude for a tutor that has given me guidance throughout the computer programming course? Thank you so much!arrow_forwardMath 130 Introduction to Java programming May I please have a written review expressing my gratitude for a tutor that has given my guidance throughout my computer programming course? Thank youarrow_forwardPlease help me translate the java code to jack codearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY