Java: An Introduction to Problem Solving and Programming (8th Edition)
8th Edition
ISBN: 9780134462035
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2.1, Problem 14STQ
What is the output produced by the following lines of
double result = (1 / 2) * 2;
System.out.println(“(l / 2) * 2 equals”+ result);
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What should be the output from the function below? void display(void) { int i; for(i = 0 ; i <= 5; i++) printf("%d ", i - i * i); }
What is the output of the following code ? x = 0
if x < 4 :
x = x + 1
print ("x is " , x )
Given the snippet of code:
int al = {2, 4, 6, 8, 10, 12), x, *p = a;
x = *(p + 4)+1;
printf("%d", x);
What will be the value of x after the following statement is executed?
13
5
12
11
Chapter 2 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Ch. 2.1 - Prob. 1STQCh. 2.1 - Can a Java program have two different variables...Ch. 2.1 - Prob. 3STQCh. 2.1 - Give the declaration for two variables of type...Ch. 2.1 - Write the declaration for two variables called...Ch. 2.1 - What is the normal spelling convention for named...Ch. 2.1 - Prob. 7STQCh. 2.1 - Prob. 8STQCh. 2.1 - Prob. 9STQCh. 2.1 - Prob. 10STQ
Ch. 2.1 - Prob. 11STQCh. 2.1 - In the Programming Tip entitled Type Casting a...Ch. 2.1 - What is the output produced by the following lines...Ch. 2.1 - What is the output produced by the following lines...Ch. 2.1 - Prob. 15STQCh. 2.1 - Prob. 16STQCh. 2.1 - Consider the following statement from the program...Ch. 2.1 - Prob. 18STQCh. 2.2 - Prob. 19STQCh. 2.2 - What output is produced by the following...Ch. 2.2 - What output is produced by the following...Ch. 2.2 - What output is produced by the following...Ch. 2.2 - What output is produced by the following...Ch. 2.2 - What output is produced by the following...Ch. 2.2 - What is the value of the expression sl.equals(s2)...Ch. 2.2 - What is the value of the expression s1.equals (s2)...Ch. 2.3 - Write Java statements that will cause the...Ch. 2.3 - What is the difference between the methods...Ch. 2.3 - Write a complete Java program that reads a line of...Ch. 2.3 - Write a complete Java program that reads one line...Ch. 2.3 - What output is produced by the following...Ch. 2.4 - Prob. 32STQCh. 2.4 - What is the output produced by the following Java...Ch. 2.4 - Although it is kind of silly, state legislatures...Ch. 2.5 - Prob. 35STQCh. 2.5 - Give a Java statement that will display a dialog...Ch. 2.5 - Give a Java statement that, when executed, will...Ch. 2.5 - Prob. 38STQCh. 2.5 - Write a complete Java program that produces a...Ch. 2.5 - Write a complete Java program that behaves as...Ch. 2 - Write a program that demonstrates the approximate...Ch. 2 - Write a program that demonstrates type casting of...Ch. 2 - Write a program that demonstrates the operator %...Ch. 2 - If u = 2, v = 3, w = 5, x = 7, and y = 11, what is...Ch. 2 - What changes to the ChangeMaker program in Listing...Ch. 2 - If the int variable x contains 10, what will the...Ch. 2 - Write some Java statements that use the String...Ch. 2 - Prob. 8ECh. 2 - Prob. 9ECh. 2 - Write a single Java statement that will display...Ch. 2 - What does the Java code Scanner keyboard = new...Ch. 2 - What does the Java code Scanner keyboard = new...Ch. 2 - Prob. 13ECh. 2 - Many sports have constants embedded in their...Ch. 2 - Prob. 15ECh. 2 - Define named constants that you could use in...Ch. 2 - Write a program that reads three whole numbers and...Ch. 2 - Write a program that uses Scanner to read two...Ch. 2 - Write a program that reads the amount of a monthly...Ch. 2 - Write a program that reads a four-digit integer,...Ch. 2 - Prob. 5PCh. 2 - Prob. 6PCh. 2 - Write a program that converts degrees from...Ch. 2 - Write a program that reads a line of text and then...Ch. 2 - Write a program that will read a line of text as...Ch. 2 - Write a program that asks the user to enter a...Ch. 2 - Write a program that determines the change to be...Ch. 2 - Write a program that reads a 4-bit binary number...Ch. 2 - Prob. 7PPCh. 2 - The Harris-Benedict equation estimates the number...Ch. 2 - Repeat any of the previous programming projects...Ch. 2 - Write a program that reads a string for a date in...Ch. 2 - It is important to consider the effect of thermal...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
T F If a class has a pointer as a member, its a good idea to also have a copy constructor.
Starting Out with C++ from Control Structures to Objects (8th Edition)
What is the purpose of the Application classs abstract start method?
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Given that y=ax3+7, which of the following are correct Java statements for this equations? int y = a x x x +...
Java How To Program (Early Objects)
Is the following program legal? If so, what is the output? #include iostream #include vector using namespace st...
Problem Solving with C++ (10th Edition)
Suppose an amateur programmer writes a program for his or her own use and in doing so is sloppy in the programs...
Computer Science: An Overview (12th Edition)
What do you call a program that performs a specialized task, such as a virus scanner, a file-compression progra...
Starting Out with C++ from Control Structures to Objects (9th 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
- int i=0; while(i<10) { printf(“I am inside the loop”); } What is wrong with this block of C code? Mark the errors and fix them.arrow_forwardIn c void f (int *p, int * const q) { p=q *p=3; *p=4; } int i = 1, j =2; int main(){ f(&i, &j); printf("%d %d",i,j); return 0; } a. The program prints 1 2 and terminates b. the program prints 1 3 and 0 c. the program prints 1 4 and terminates d. the program prints 3 4 and terminates e. the program has compiler errorarrow_forward- Consider the code char x = 'A"; void test(int n) { printf("%d ", n); if(n > 0) Missing 1 if(n == 0) printf("\n"): printf("%c ",_Missing_2: !! main) { test(4); However, part of the code is missing (indicated by output ). The code is supposed to give the 420 ABC What can the missing parts be? U Missing 1: test(n - 2) Missing 2: x++ O Missing 1: test(n +2) Missing 2: x-- O Missing_1: x -= 2 Missing 2: test(n - 1) O Missing_1: test(n - 1) Missing_2: x -= 2arrow_forward
- I need help with this problem. Please help me, because I do not understand. if 14 > 7: print("Greater than 14") x = 2 print(x * 7) else: print("Less than") print(7)arrow_forwardWhat is the final value of x when the following code is run? int x;for(x =1; x<20; x+=2) {}arrow_forwardWhat is the value of *q after the following code has been executed? int i = 5;int j= 10;int *p;int *q; p = &i;q = &j;q = p;arrow_forward
- Write pseudo code that will count all the even numbers up to a user defined stopping point. (Please make it readable)arrow_forward5- What is the output for y? int y = 0; for (int i = 0; i< 10; ++i) { y +=i; } cout << y;arrow_forwardGiven: char newFunc(int & a, int b) { char output = 'Q'; %3D while (aarrow_forwardThe output of the following code snippet is: int main() { char a='P'; printf("Value of a is %c",a); } Select one: a. Value of a is c b. Value of P is c c. Value of P is a d. Value of a is Parrow_forwardWhat is wrong in the following code? double x = 3.0;int* pX = &x;arrow_forward%% [0-9] printf("number"); [a-zA-Z] printf("letter"); T+EN+ printf("10"); According to the above lex rules, what is the expected output for the following inputs? TTENN TEEN 10arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY