Java How to Program, Early Objects (11th Global Edition) - Does NOT include MyLab Programming
11th Edition
ISBN: 9780134800301
Author: Harvey Deitel, Paul J. Deitel
Publisher: Pearson Global Edition
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 4.1E
Assuming that x = 2 and y = 3, what does each of the following statements display?
System.out.printf("x = %d%n", x);
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
.Use Java programing
.Provide Pseudocode and Flowchart
.use loop if you need to
Evaluate each of the following expressions. Assume the following:
int a = 3, b = 7; float x = 6.0, y = 3.1 z = 2.0 (int)y * 10 + b
3.Professor Mysterious uses a special formula to calculate the grade of his
students. Write a program that repeatedly does the following:
a. Prompt the user to enter the grade of the first test
b. Prompt the user to enter the grade of the second test
. Prompt the user to enter the grade of the third test.
The program should then calculate and displays the student grade based on the
following formula:
grade-.25*testi+.61 test2+.14 test3
NOTE: Exit the program using sentinel or magic value.
SAMPLE PROGRAM RUN
Enter Test1 (0 to exit): 100
Enter Test2:90
Enter Test3:87
Grade: 92.08
Enter Test1 (0 to exit): 0
Thank you for using this program.
Chapter 2 Solutions
Java How to Program, Early Objects (11th Global Edition) - Does NOT include MyLab Programming
Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Prob. 1.7SRECh. 2 - State whether each of the following is true or...Ch. 2 - State whether each of the following is true or...Ch. 2 - State whether each of the following is true or...
Ch. 2 - State whether each of the following is true or...Ch. 2 - State whether each of the following is true or...Ch. 2 - Prob. 2.6SRECh. 2 - Write statements to accomplish each of the...Ch. 2 - Write statements to accomplish each of the...Ch. 2 - Write statements to accomplish each of the...Ch. 2 - Prob. 3.4SRECh. 2 - Prob. 3.5SRECh. 2 - Write statements to accomplish each of the...Ch. 2 - Prob. 4.1SRECh. 2 - Identify and correct the errors in each of the...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Write declarations, statements or comments that...Ch. 2 - Using the statements you wrote in Exercise 2.5,...Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Fill in the blanks in each of the following...Ch. 2 - Prob. 1.4ECh. 2 - Fill in the blanks in each of the following...Ch. 2 - Write Java statements that accomplish each of the...Ch. 2 - Write Java statements that accomplish each of the...Ch. 2 - Write Java statements that accomplish each of the...Ch. 2 - Prob. 3.1ECh. 2 - State whether each of the following is true or...Ch. 2 - State whether each of the following is true or...Ch. 2 - State whether each of the following is true or...Ch. 2 - Assuming that x = 2 and y = 3, what does each of...Ch. 2 - Assuming that x = 2 and y = 3, what does each of...Ch. 2 - Assuming that x = 2 and y = 3, what does each of...Ch. 2 - Prob. 4.4ECh. 2 - Prob. 5.1ECh. 2 - Which of the following Java statements contain...Ch. 2 - Prob. 5.3ECh. 2 - Which of the following Java statements contain...Ch. 2 - Given that y=ax3+7, which of the following are...Ch. 2 - Given that y=ax3+7, which of the following are...Ch. 2 - Given that y=ax3+7, which of the following are...Ch. 2 - Given that y=ax3+7, which of the following are...Ch. 2 - Given that y=ax3+7, which of the following are...Ch. 2 - Given that y=ax3+7, which of the following are...Ch. 2 - State the order of evaluation of the operators in...Ch. 2 - Prob. 7.2ECh. 2 - State the order of evaluation of the operators in...Ch. 2 - Display the message "Enter an integer: ", leaving...Ch. 2 - Assign the product of variables b and c to the int...Ch. 2 - Use a comment to state that a program performs a...Ch. 2 - Prob. 9.1ECh. 2 - (Comparing Integers) Write an application that...Ch. 2 - Which of the following Java statements contain...Ch. 2 - Given that y = ax3 + 7, which of the following are...Ch. 2 - State the order of evaluation of the operators in...Ch. 2 - What does the following code print?...Ch. 2 - What does the following code print?...Ch. 2 - What does the following code print?...Ch. 2 - What does the following code print?...Ch. 2 - (Largest and Smallest Integers) Write an...Ch. 2 - (Odd or Even) Write an application that reads an...Ch. 2 - Write an application that reads two integers,...Ch. 2 - Write an application that displays a checkerboard...Ch. 2 - Circumference and Area of a Circle) Heres a peek...Ch. 2 - (Integer Value of a Character) Heres another peek...Ch. 2 - (Separating the Digits in an Integer) Write an...Ch. 2 - Prob. 25.1ECh. 2 - Prob. 26.1ECh. 2 - (Body Mass Index Calculator) We introduced the...Ch. 2 - (World Population Growth Calculator) Search the...
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
- The correct declaration statement is: int X; Y; int X, Y; int X, Y int X, Y,arrow_forwardplease fastarrow_forwardWrite an application that displays the numbers 1 to 4 on the same line, with each pair ofadjacent numbers separated by one space. Use the following techniques:a) Use one System.out.println statement.b) Use four System.out.print statements.c) Use one System.out.printf statement.What does the following code print?d) System.out.printf( "%s\n%s\n%s\n", "*", "***", "*****" );arrow_forward
- Assume that you have run the following statements: x = 3y = "4"z = "5.6" Which expression would NOT cause an error? str(x, y) + z str(x) + int(y) y + z x + yarrow_forwardThe following statement is supposed to print the integers from 1 to 10, but it contains an error. for (i = 1; i >= 10; i++) System.out.println(i); A.) What will be printed when the statement is executed? B.) Describe the error and show how to fix it.arrow_forwardAnalyze the following code: int x = 0;if (x > 0) ;{System.out.println(x);} The code has syntax error. The code has run time error. The value of variable x is always printed because the print statement is not controlled by the if condition. Nothing is printed because x > 0 is false if x = 0.arrow_forward
- 2. Convert the following if statements into switch statements? if (x== 0) { answer = "Condition 1 passed; } else if (x= 10) { answer = "Condition 2 passed"; } else { answer = "No conditions passed"; }arrow_forwardHi! I need help with the Java programming for these 2 questions! Thank you :)arrow_forward2- Number of basic operations of the following statement is equal to : for ( int i = 0 ; i< = 1 ; ++i) System.out.println( "X+1"+"Y"); A- 5 B- 6 C- 7 D- Nonearrow_forward
- Problem: Meal gift card. Your favorite campus restaurant sells meals for $13 each meal. The restaurant requires members to pre-pay any amount of money they wish, and then purchase as many meals accordingly. You are required to write a java program correctly that would ask the user for the amount that they will pay, then display a message indicating how many meals that user will be able to purchase as well as how much funds will remain in the gift card after that. Using exactly 1 integer constant, 3 integer variables, and 1 Scanner variable make sure to fulfill the following points: 1. Declare the following constant integer: PRICE and set it to 13. 2. Declare 3 unassigned integer variables amount, meals, balance. 3. Declare 1 Scanner variable that will record keyboard inputs. 4. Prompt the user in the console for the amount that they will pay and assign to amount (use same format and wording as in the sample outputs below). Assume the user will enter an integer value. 5. Assign to…arrow_forwardConvert the following statements into intermediate code: int r=0;for (int i=0; i<10; i++) r=r+i;arrow_forwardAfter executing the following statements the value of the variable a will be 4: double d =3.7; int a = d; Select one: No Yesarrow_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
Algebraic Expressions – Algebra Basics; Author: TabletClass Math;https://www.youtube.com/watch?v=U-7nq7OG18s;License: Standard YouTube License, CC-BY
Python Tutorial for Beginners 3 - Basic Math, Mathematical Operators and Python Expressions; Author: ProgrammingKnowledge;https://www.youtube.com/watch?v=Os4gZUI1ZlM;License: Standard Youtube License