Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
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 is the output produced by the following lines of program code?char a, b;a = 'b';
System.out.println(a);b = 'c';System.out.println(b);a = b;System.out.println(a);
What is the output produced by the following lines?System.out.println(2 + " " + 2);System.out.println(2 + 2);
What is the output of this program?
#include<studio.h>int MAX (int a, int b)
{if (a > b)
return a;
else
return b;
}int main()
{
int x;
x= MAX(3+2, 2+7);
printf("%d\n",x);
return 0;
}
Chapter 2 Solutions
Java: An Introduction to Problem Solving and Programming (7th 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
- Given the following code, what is the final value of x? int x=1, y=2, z=3; bool w=true; x=w=y-z;arrow_forwardWrite a program that will display the following pattern.arrow_forwardWhat will be the output of the following line of code? void show(); int main() { show(); printf("ARGENTINA "); return 0; } void show() { printf("AFRICA "); }arrow_forward
- write a program that produces the following output:  in your program, substitute ??? with your own name. if necessary, adjust the positions and the number of the stars to produce a rectangle.arrow_forwardWhat is the output produced by the following lines of program code?int n = (int)3.9;System.out.println("n == " + n);arrow_forwardWrite a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15 3 the output is: 3 ''' Type your code here. '''arrow_forward
- What is the output produced by the following lines of program code?int n = 3;n++;System.out.println("n == " + n);n−−;System.out.println("n == " + n);arrow_forwardWrite a program that take input a value x from user and print the value 2*x*sin2x.arrow_forwardwhat is the output of the following code fragment? int x =10; if (x > 15) x =0; System.out.println(x);elseSystem.out.println(x+5);arrow_forward
- What would the output be from the following line: 6 + 4 / 2 5 8.0 8 5.0arrow_forwardWhat is the output of the following code segments (when run independently)? int [ ] myAry = {10,20,30,40,50}; for (int x=0; x<=myAry.length-1; x++ ) System.out.print(" " + myAry[x] ); note : a java codearrow_forward) What will be the output of following code? Also give step by step explanation for determining the output.#include<stdio.h> int pqr(int,int);int main(){int x=pqr(20,2);printf("%d",x);return 0;}int pqr(int x,int y){if(x==0){return 0;}else{return x+pqr(x/y,y);}}arrow_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
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