What is the output produced by the following Java code?
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Absolute Java (6th Edition)
Additional Engineering Textbook Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Mechanics of Materials (10th Edition)
Electric Circuits. (11th Edition)
Degarmo's Materials And Processes In Manufacturing
Starting Out with C++ from Control Structures to Objects (9th Edition)
- CODE IN C# NOT JAVA (reject if you can't do C# please): Write an application that runs 1,000,000 games of craps and answers the following questions (explain each step): How many games are won on the first roll, second roll, …, twentieth roll and after the twentieth roll? How many games are lost on the first roll, second roll, …, twentieth roll and after the twentieth roll? What are the chances of winning at craps? [Note: You should discover that craps is one of the fairest casino games. What do you suppose this means?] What is the average length of a game of craps?arrow_forwardstarsPrint ♡ Language/Type: Java expressions % What output is produced by each of the following code samples? // A) for (int i = 0; i < 5; i++) { } for (int j = 0; j < 10; j++) { System.out.print("*"); } System.out.println(); // to end the line // B) for (int i = 1; i <= 5; i++) { for (int j = 1; j <= i; j++) { System.out.print("*"); } System.out.println(); } // C) for (int i = 1; i <= 5; i++) { for (int j = 1; j <= i; j++) { System.out.print(i); } System.out.println(); M 31 A) B) C) 111 C Submit ¤ Uarrow_forwardSubject: Computer Educationarrow_forward
- // SuperMarket.java - This program creates a report that lists weekly hours worked // by employees of a supermarket. The report lists total hours for // each day of one week. // Input: Interactive // Output: Report. import java.util.Scanner; public class SuperMarket { public static void main(String args[]) { // Declare variables. final String HEAD1 = "WEEKLY HOURS WORKED"; final String DAY_FOOTER = " Day Total "; // Leading spaces are intentional. final String SENTINEL = "done"; // Named constant for sentinel value. double hoursWorked = 0; // Current record hours. String hoursWorkedString = ""; // String version of hours String dayOfWeek; // Current record day of week. double hoursTotal = 0; // Hours total for a day. String prevDay = ""; // Previous day of week. boolean done = false; // loop control Scanner input = new…arrow_forwardCalculate your Physics final Write a Java program to solve the following problem: grade based on the following: Assessment Percent Lab Activity(ies) Quiz (zes)/Test (s) 10% 10 Assignment (s) 208 Midterm Exam (8) 20% Final Exam 40% Theory grade is the quiz/test, midterm and final exam marks. Practical grade is the assignment and lab marks. Final grade is all five marks. But the calculation of Final grade needs to comply with the following rule: If either of the practical or theory grade is less than 50%, the final grade is the lesser of the two. A grade letter must be assigned based on the final grade (See the courses outline for the distribution of grades) You must implement input validation for each mark as follows: Lab mark must be out of 10. Quiz/Test mark must be out of 10. Assignment mark must be out of 20. Midterm mark must be out of 20. Final Exam must be out of 40. Bonus: Modify your code so that you can calculate and display grade for N number of students. Your program must…arrow_forward1- Write a complete Java program that prompts for and reads three quiz grades for each student in a class of four students. The program then computes and displays the average for each student. Your program must be easily modifiable to handle any number of students and quizzes. The program does the following for each student in the class: It prompts the user to enter student's grades for 3 quizzes. It outputs the average score. Student No. 1: Enter grade for quiz No. 1 : 78 Enter grade for quiz No. 2 : 89 Enter grade for quiz No. 3 : 90 The average score for student No. 1 = 85.6667 Student No. 2: Enter grade for quiz No. 1 : 100 Enter grade for quiz No. 2 : 90 Enter grade for quiz No. 3 : 70 The average score for student No. 2 = 86.6667 Student No. 3: Enter grade for quiz No. 1 : 60 Enter grade for quiz No. 2 : 78 Enter grade for quiz No. 3 : 90 The average score for student No. 3 = 76 Student No. 4: Enter grade for quiz No. 1 : 76 Enter grade for quiz No. 2 : 58…arrow_forward
- a) The following attempt at Java code might have been written by a beginner. Identify (but do not correct) as many of the mistakes as you can. Explain how each oddity you identify is either something that would prevent the program from compiling, something that would cause it to stop abruptly reporting failure at runtime. //* A comment to start with: Exam:2000 */ public Class mycode.java { void static public fun main(String [junk]) begin Leaf tr = null; for (i=1; i>10; ++i) tr = new Node(i, tr) tr.print(); end; } class Leaf { integer value; Leaf(int value) { this = value; } public void print(){ System.out.println(value); } } class Node extends Leaf { Leaf left, right; Node(leaf l, Leaf r) { left = l, right = r; } void print() { left.print(); System.out.println("val=" @ value); right.print(); } } b) Comment each line of code.arrow_forwardNote:- Please type and execute this java program and also need an output for this program.arrow_forwardanswer quicklyarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT