Concept explainers
What output is produced by the following code? For each output line, describe whether the line begins or ends with a blank or blanks.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Absolute Java (6th Edition)
Additional Engineering Textbook Solutions
Modern Database Management
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
SURVEY OF OPERATING SYSTEMS
Java: An Introduction to Problem Solving and Programming (8th Edition)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Management Information Systems: Managing The Digital Firm (16th Edition)
- Write code that outputs variable numMonths as follows. End with a newline. Ex: If the input is: 3 the output is: Months: 3 Phyton codearrow_forwardQ1: The local Driver's License Office has asked you to write a program that grades the writ- ten portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1. A 2. D 3. B 4. B 5. C 6. B 7. A 8. B 9. C 10. D 11. A 12. C 13. D 14. B 15. D 16. C 17. C 18. A 19. D 20. B Your program should store the correct answers shown above in an array. It should ask the user to enter the student's answers for each of the 20 questions, and the answers should be stored in another array. After the student's answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions. Input Validation: Only accept the letters A, B, C, or…arrow_forwardCode in Java - While Loop Write a program that takes an integer and prints the number of trailing zeroes. Trailing zeroes are the zeroes found at the right side of a number.arrow_forward
- Write an application that reads an integer and determines and prints whether it’s odd or even. [Hint: Use the remainder operator. An even number is a multiple of 2. Any multiple of 2 leaves a remainder of 0 when divided by 2.]arrow_forwardoptions same for each onearrow_forwardPart 2 - OddOrEven ClassIn bluej. Write a program that prompts the user to enter an integer. The program should display “The input is odd" to the screen if the input is odd and displays “The input is even" to the screen if the input is even. Hint: Consider using the mod (%) operator.arrow_forward
- What is the output of the following code when x is * .equal 5 x = CInt(Text1.Text) If x = 1 Then MsgBox ("Sunday") Elself x = 2 Then MsgBox ("Monday") Elself x = 3 Then MsgBox ("Tuesday") Elself x = 4 Then MsgBox ("Thursday") Elself x = 5 Then MsgBox ("Wednesday") Elself x = 6 Then MsgBox ("Friday") Elself x = 7 Then MsgBox ("Saturday") Else MsgBox ("This is not correct number") End If All of the above O This is not correct number Sunday Non of the above Wednesday Oarrow_forward5- What is the output for y? int y = 0; for (int i = 0; i< 10; ++i) { y +=i; } cout << y;arrow_forwardWrite a code that asks the user to enter several numbers that are a multiple of 5. If the user enters a value that is not a multiple of 5 it should print a message and prompt the user to enter a new number. The user can stop the process by inputting the string *done*. At the end, print the total number of values entered that are a multiple of 5.arrow_forward
- What is the output of the following code when x is equal 5. x Clnt(Text1.Text) If x = 1 Then MsgBox ("Sunday") Elself x = 2 Then MsgBox ("Monday") Elself x = 3 Then MsgBox ("Tuesday") Elself x = 4 Then MsgBox ("Thursday") Elself x = 5 Then %3D MsgBox ("Wednesday") Elself x = 6 Then MsgBox ("Friday") Elself x = 7 Then MsgBox ("Saturday") Else MsgBox ("This is not correct number") End If Wednesday All of the above Sunday Non of the above This is not correct numberarrow_forwardComplete the if-else statement to output "Below 90" if the value of userInput is below 90. Otherwise, output "90 or more". Ex: If the input is 88, then the output is: Below 90 1 import java.util.Scanner; 3 public class Relational { 345678 9 10 11 12 13 14 FREEdd public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userInput; 15 16 } 17 } userInput = scnr.nextInt (); if (* Your code goes here */) { System.out.println("Below 90"); } else { } System.out.println("90 or more");arrow_forwardWhich code segment results in "true" being returned if a number is even? Replace "MISSING CONDITION" with the correct code segment. function isEven(num){ if(MISSING CONDITION){ return true; } else { return false; } } A. num % 2 == 0; B. num % 0 == 2; C. num % 1 == 0; D. num % 1 == 2;arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT