Java How To Program (Early Objects)
10th Edition
ISBN: 9780133807943
Author: Deitel, Paul
Publisher: Pearson Education
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 12.1E
Given that y = ax3 + 7, which of the following are correct Java statements for this equation?
- 1. int y = a * x * x * x + 7;
- 2. int y = a * x * x * (x + 7);
- 3. int y = (a * x) * x * (x + 7);
- 4. int y = (a * x) * x * x + 7;
- 5. int y = a * (x * x * x) + 7;
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
java
You must print the number declared double x; on the screen. With which of the following options do you know that a number in the range -9999.99999 to 9999.99999 is printed with exactly 4 decimals and that all numbers in the number are displayed?
Choose an alternative:
a.System.out.format ("%. 4f", x);
b.System.out.format ("% 4.1f", x);
c.System.out.format ("% b", x);
d.System.out.format ("% s", x);
e.System.out.format ("% d", x);
This is in JAVA
What is the final value of y?
intx=77;int y = 4;if (x == 77) {y = y + 1;}if (x < 100) {y = y + 1;}if (x > 77) {y = y + 1;}y = y + 1;
A. 5
B. 6
C. 7
D. 8
Write a Java regular expression for each of the following: a. Phone numbers, such as (609) 555-1234 b. Social Security numbers, such as 123-45-6789 c. Dates, such as December 31, 1999
Chapter 2 Solutions
Java How To Program (Early Objects)
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 - 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 - Prob. 5.3SRECh. 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 - Fill in the blanks in each of the following...Ch. 2 - Prob. 1.5ECh. 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...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Indicate true or false for the following statements: a.A protected datum or method can be accessed by any class...
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
For each of the following E-R diagrams from Chapter 2 C: Transform the diagram to a relational schema that show...
Modern Database Management
What will be the final value of dblResult in the following sequence? Dim dblResult As Double = 3.5 dblResult = ...
Starting Out With Visual Basic (8th Edition)
What makes Python an interpreted programming language?
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Write the code to set up all the necessary objects for reading keyboard input. Then write code that asks the us...
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Which category of C++ reference variables always produces aliases?
Concepts Of Programming Languages
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
- This is in JAVA. Which expressions for YYY and ZZZ correctly output the indicated ranges? Assume int x's value will be 0 or greater. Choices are in the form YYY / ZZZ. if(YYY){// Output "0-29"} else if (ZZZ) {// Output "30-39"}else {// Output "40+"} A. x < 29 / x >= 29 B. x < 30 / x >= 30 C. x < 30 / x < 40 D. x > 29 / x > 40arrow_forwardCode the following statments in JAVA If your average time to run each mile is under 11 minutes, display a"you got gold" message 5. If your average time to run each mile is under 15 minutes, display a"you got silver" message 6. If your average time to run each mile is equal to or more than 15minutes, "you got bronze" messagearrow_forwardWrite a java program that calculates the cost of individual items, including tax, and prints the grocery bill. Your program must do the following: 1. Ask the user to enter his/her full name. 2. Print a welcome message using the user’s name. 3. Ask the user to enter the name of the item. 4. Ask the user to enter the price and quantity of the item. 5. Declare a constant variable that holds a tax rate equal to 15%. 6. Calculate the total price of the item, including the tax. 7. Print the grocery bill. The class name of your Java program must be your first name.arrow_forward
- Output a half pyramid of stars with a height determined by the user. If the user enters a number less than one, exit. Write in java that will results like test case examplesarrow_forwardPrompt the user for a number x and output the sum of all numbers from 1 to x. If the number entered it less than zero, output an error message. Write a code in Java that will result like test case examples .arrow_forwardSuppose you have a real number variable x. Write a Java expression that computes the following value y while using the * operator only four times: y=12.3x4−9.1x3+19.3x2−4.6x+34.2arrow_forward
- The following program takes two numbers as input from the user when run and is supposed to add those numbers together and print the result. I am compiling and then running the program like so: > javac Example.java > java Example 5,3 There are two problems. One line of code needs changed and the way I'm running the code needs changed. What are those changes? public class Example { public static void main(String[] args) { int result = addValues(args); System.out.println("The sum of your numbers is: "+result); } public static int addValues(String x, String y) { int tempx = Integer.parseInt(x); int tempy = Integer.parseInt(y); return tempx + tempy; } }arrow_forwardWrite a program called TimeConvertor.java that converts times expressed in 24-hour clock to 12-hour clock and that converts times expressed in 12-hour clock to the 24-hour clock. Here are five examples of what the program should look like when it runs:i. Enter a time ([h]h:mm [am|pm]): 00:00 12:00 amii. Enter a time ([h]h:mm [am|pm]): 12:00 am 00:00iii. Enter a time ([h]h:mm [am|pm]): 4:00 pm 16:003iv. Enter a time ([h]h:mm [am|pm]): 17:01 5:01 pmv. Enter a time ([h]h:mm [am|pm]): 5:11 am 05:11arrow_forwardWrite a Java program that lets the user enter the monthly interest rate, number of years, and loan amount, and computes monthly payment and total payment and print both results each on a separate line. The total payment = monthlyPayment * 12 * numberOfYears monthy payment = (loan amount)*(monthy interest rate)/(1 - (1/(1+monthly interest rate)^(number of years * 12)))arrow_forward
- THIS IS IN JAVA Given x = 1, y = 2, and z = 3, how is the expression evaluated? In the choices, items in parentheses are evaluated first. <pre><code>(x == 5) || (y == 2) && (z == 5)</code></pre> A. false OR (true AND false) --> false OR false --> false B. false OR (true AND false) --> false OR true --> true C. (false OR true) AND false --> true AND false --> false D. (false OR true) AND false --> true AND false --> truearrow_forwardAn Arabian legend has it that a fabulously wealthy but unthinking king agreed to give a bigger one cent and double the amount for 60 days. Using this information write, run and test a Java program that displays how much King must pay the beggar each day. example days. Amount 1. 0.01 2. 0.02 3. 0.04 . 64 days. .... note:- 1) modify the program that you have write To determine on which day king must have paid the beggar a million dollararrow_forwardWrite a program In java that asks for the user's age. If the age is under 13, output, "You are a child". if age is greater than 13 and less than 19, output, "You are a teen". if age is greater than 19 and less than 65, output, "You are an adult". Over 65, "You are a senior citizen".arrow_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
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License