Java Programming
8th Edition
ISBN: 9781305981829
Author: Joyce Farrell
Publisher: Cengage Limited
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 2, Problem 10RQ
Program Description Answer
The Java statement “System.out.println(“w\nxyz”);” prints w on one line and xyz on the next line.
Hence, the correct answer is option “C”.
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);
33. What is the output of the following Java code?
int x =3;
do {
System.out.print(x + " ");}while (x >= 1);
System.out.println();
Problem: Write a Java language program the will accept username and five (5) score grades of students, Get the total and average of the five (5) scores of the students, and determine Average if "Passed" or "Failed". Passing score is 75.
Filename: Exam3.java
Chapter 2 Solutions
Java Programming
Ch. 2 - Prob. 1RQCh. 2 - Prob. 2RQCh. 2 - Prob. 3RQCh. 2 - Prob. 4RQCh. 2 - Prob. 5RQCh. 2 - Prob. 6RQCh. 2 - Prob. 7RQCh. 2 - Prob. 8RQCh. 2 - Prob. 9RQCh. 2 - Prob. 10RQ
Ch. 2 - Prob. 11RQCh. 2 - Prob. 12RQCh. 2 - Prob. 13RQCh. 2 - Prob. 14RQCh. 2 - Prob. 15RQCh. 2 - Prob. 16RQCh. 2 - Prob. 17RQCh. 2 - Prob. 18RQCh. 2 - Prob. 19RQCh. 2 - Prob. 20RQCh. 2 - Prob. 1PECh. 2 - Prob. 2PECh. 2 - Prob. 4PECh. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - Prob. 7PECh. 2 - Prob. 8PECh. 2 - Prob. 9PECh. 2 - Prob. 10PECh. 2 - Prob. 11PECh. 2 - Prob. 12PECh. 2 - Prob. 1GZCh. 2 - Prob. 2GZCh. 2 - Prob. 1CPCh. 2 - Prob. 2CP
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
- What is the output of the following code segment?inte=5,f=10;if(eff0) Write(Red); else Write(Orange);Â a. Red b. Orange c. RedOrange d. nothingarrow_forwardQuestion 2 [50 points]: Write a Java program that reads from the user the result of a match between 2 teams in the FIFA World Cup in a single line. Then computes and prints the winning team or indicates that the teams tied! Test your code when the winning team is the first one, when the winning team is second one and when the match is drawn. Hint: The user should insert the 4 values in the same line using only one prompt message. Sample run1: Insert the result of the match: England 1 2 Italy Italy is the winning team Sample run2: Insert the result of the match: Brazil 1 1 Argentina Brazil and Argentina tied! Sample run3: Insert the result of the match: England 3 1 Brazil England is the winning teamarrow_forwardWrite the lines(s) of code required to instantiate a patient object called sick and set that patient's heart rate to 75. You may choose the values of other parameters for this patient, but only use methods/constructors that have been provided (or that you wrote) on the the previous page).arrow_forward
- in java: Write a program that reads the following information and prints a payroll statement: Employee’s name (e.g., Smith) Number of hours worked in a week (e.g., 10) Hourly pay rate (e.g., 9.75) Federal tax withholding rate (e.g., 20%) State tax withholding rate (e.g., 9%) Your program must use proper formatting for the output either by using the printf command or String.formatarrow_forwardcan you please write it in java.util.scanner form Write a program that prompts the user to enter a number within the range of 1 through 10. The program should display the Roman numeral version of that number. If the number is outside the range of 1 through 10, the program should display an error message. but use switch statement for the program.arrow_forwardWhat is the output of the statements below? x=3 while xarrow_forward
- I need help writing a Java Code. Write a program that prompts the user to enter an integer for today's day of the week (Sunday is 0, Monday is 1, and Saturday is 6. Also, prompt the user to enter the number o days after today for a future day and display the future day of the week.arrow_forwardcan you please write it in java.util.scanner form Write a program that prompts the user to enter a number within the range of 1 through 10. The program should display the Roman numeral version of that number. If the number is outside the range of 1 through 10, the program should display an error message. Use if...else...if statement for this question.arrow_forwardWrite a single print statement that outputs the following (make sure you keep the same formatting): Use Java. \* This is not a "comment",it is just some 'random' text *\\\ still not a commentarrow_forward
- 1. Ask the user for two numbers,compare them and print out if the first one is greater than, less than or equal to the other. If done correctly, the output should look something like this ----jGRASP exec: java LabActivity10 3 is less than 4 ----jGRASP: operation complete 2. Create a program that outputs the following (must use a for-loop) ----jGRASP exec: java LabActivity10 2 4 6 8 10 12 14 16 18 20 ----jGRASP: operation complete. 3. Create a String with the value "Bring the beet in!", make a substring that will hold just "beet" in it and print it (Hint: use String methods). Expected output: ----jGRASP exec: java LabActivity10_3 beet ----jGRASP: operation complete 4. Get user to enter a phrase and print out how long the phrase is(Hint: use String method). Expected output: ----jGRASP exec: java LabActivity10_4 Enter a phrase I am Beyonce always Your phrase length is 19 ----jGRASP: operation complete 5. Create a void method called greet that prints "Hello". Call the greet method in…arrow_forwardWhich is the best statement about Java's Error class? Select one: O A thrown Error indicates a condition that a reasonable application should catch. O A thrown Error indicates a serious problem that a reasonable application should not try to catch. O A thrown Error indicates user input error. O None of these optionsarrow_forwardWrite a code in Java: Write a program that will prompt the user for a temperature, and a choice to convert that temp to f or c. The program should then return the correctly converted temperature. Use conditional statements such as "if" and "else."arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT