Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 4, Problem 3FTE

Explanation of Solution

Program purpose:

The given program is used to add two numbers entered by the user.

Syntax error:

An error which occurs on the source code of a program is referred to as a “syntax error” because the computer programs strictly follow the syntax rules. If the code fails to prove its language syntax format, then the compiler will throw an error.

Error #1:

The expression being tested by the “do-while” loop should be “choice ==1”.

Corrected statement:

//check the condition

}while(choice == 1)

Error #2:

The “do-while” loop must be terminated with semicolon...

Blurred answer
Students have asked these similar questions
CPS 2390 Extra Credit Assignment For each problem, choose the best answer and explain how you arrived at your answer. (15 points each.) 1.If control is redirected to location x4444 after the execution of the following instructions, what should have been the relationship between R1 and R2 before these instructions were executed? Address Instruction x4400 1001100010111111 x4401 0001100100100001 x4402 0001100001000100 x4403 0000100001000000 A. R1 R2 (R1 was greater than R2) B. R1 R2 (R2 was greater than R1) C. R1 R2 (R1 and R2 were equal) = D. Cannot be determined with the given information. 2. If the value stored in RO is 5 at the end of the execution of the following instructions, what can be inferred about R5? Address x3000 Instruction 0101000000100000 x3001 0101111111100000 x3002 0001110111100001 x3003 0101100101000110 x3004 0000010000000001 x3005 0001000000100001 x3006 0001110110000110 x3007 0001111111100001 x3008 0001001111111000 x3009 0000100111111000 x300A 0101111111100000 A. The…
Need help writing code to answer this question in Python! (image attached)
Need help with python code! How do I simplify my code for a beginner to understand, simple fixed format and centering? Such as:  print(f"As an int variable: {age_int:^7}") print(f"In numeric binary: {age_int:^7b}") My Code:name = input("Enter your name: ")print(f"In text name is: {' '.join(name)}")decimal_values = []binary_values = []for letter in name:   ascii_val = ord(letter)   binary_val = format(ascii_val, '08b')   decimal_values.append(str(ascii_val))   binary_values.append(binary_val)# Loop through each letter:print(f"In ASCII decimal: {' '.join(decimal_values)}")print(f"In ASCII binary: {' '.join(binary_values)}")# Ageage_str = input("Enter your age: ")age_int = int(age_str)print(f"As a string \"{age_str}\": {' '.join(age_str)}")age_decimal_values = []age_binary_values = []for digit in age_str:   ascii_val = ord(digit)   binary_val = format(ascii_val, '07b')   age_decimal_values.append(str(ascii_val))   age_binary_values.append(binary_val)print(f"In ASCII decimal: {'…

Chapter 4 Solutions

Starting Out with Java: From Control Structures through Data Structures (3rd Edition)

Chapter 4.5, Problem 4.11CPChapter 4.5, Problem 4.12CPChapter 4.6, Problem 4.13CPChapter 4.6, Problem 4.14CPChapter 4.6, Problem 4.15CPChapter 4.10, Problem 4.16CPChapter 4.10, Problem 4.17CPChapter 4.10, Problem 4.18CPChapter 4.10, Problem 4.19CPChapter 4.10, Problem 4.20CPChapter 4.10, Problem 4.21CPChapter 4.10, Problem 4.22CPChapter 4.10, Problem 4.23CPChapter 4.11, Problem 4.24CPChapter 4.11, Problem 4.25CPChapter 4.11, Problem 4.26CPChapter 4.11, Problem 4.27CPChapter 4, Problem 1MCChapter 4, Problem 2MCChapter 4, Problem 3MCChapter 4, Problem 4MCChapter 4, Problem 5MCChapter 4, Problem 6MCChapter 4, Problem 7MCChapter 4, Problem 8MCChapter 4, Problem 9MCChapter 4, Problem 10MCChapter 4, Problem 11MCChapter 4, Problem 12MCChapter 4, Problem 13MCChapter 4, Problem 14MCChapter 4, Problem 15MCChapter 4, Problem 16MCChapter 4, Problem 17MCChapter 4, Problem 18MCChapter 4, Problem 19TFChapter 4, Problem 20TFChapter 4, Problem 21TFChapter 4, Problem 22TFChapter 4, Problem 23TFChapter 4, Problem 24TFChapter 4, Problem 25TFChapter 4, Problem 26TFChapter 4, Problem 1FTEChapter 4, Problem 2FTEChapter 4, Problem 3FTEChapter 4, Problem 4FTEChapter 4, Problem 1AWChapter 4, Problem 2AWChapter 4, Problem 3AWChapter 4, Problem 4AWChapter 4, Problem 5AWChapter 4, Problem 6AWChapter 4, Problem 7AWChapter 4, Problem 8AWChapter 4, Problem 9AWChapter 4, Problem 10AWChapter 4, Problem 11AWChapter 4, Problem 12AWChapter 4, Problem 13AWChapter 4, Problem 14AWChapter 4, Problem 15AWChapter 4, Problem 16AWChapter 4, Problem 17AWChapter 4, Problem 18AWChapter 4, Problem 19AWChapter 4, Problem 20AWChapter 4, Problem 1SAChapter 4, Problem 2SAChapter 4, Problem 3SAChapter 4, Problem 4SAChapter 4, Problem 5SAChapter 4, Problem 6SAChapter 4, Problem 7SAChapter 4, Problem 8SAChapter 4, Problem 9SAChapter 4, Problem 10SAChapter 4, Problem 11SAChapter 4, Problem 12SAChapter 4, Problem 13SAChapter 4, Problem 14SAChapter 4, Problem 15SAChapter 4, Problem 16SAChapter 4, Problem 17SAChapter 4, Problem 18SAChapter 4, Problem 19SAChapter 4, Problem 20SAChapter 4, Problem 21SAChapter 4, Problem 22SAChapter 4, Problem 23SAChapter 4, Problem 1PCChapter 4, Problem 2PCChapter 4, Problem 3PCChapter 4, Problem 4PCChapter 4, Problem 5PCChapter 4, Problem 6PCChapter 4, Problem 7PCChapter 4, Problem 8PCChapter 4, Problem 9PCChapter 4, Problem 10PCChapter 4, Problem 11PCChapter 4, Problem 12PCChapter 4, Problem 13PCChapter 4, Problem 14PCChapter 4, Problem 15PCChapter 4, Problem 16PCChapter 4, Problem 17PCChapter 4, Problem 18PCChapter 4, Problem 19PCChapter 4, Problem 20PCChapter 4, Problem 21PCChapter 4, Problem 22PCChapter 4, Problem 23PC
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY