Study the following
// The Works of Wolfgang
public class Wolfgang
{
public static void main(String[] args)
{
System.out.print(“The works of Wolfgang\ninclude ”);
System.out.print(“the following”);
System.out.print(“\nThe Turkish March ”);
System.out.print(“and Symphony No. 40 ”);
System.out.println(“in G minor.”);
}
}
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
C Programming Language
Problem Solving with C++ (9th Edition)
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
Computer Systems: A Programmer's Perspective (3rd Edition)
Starting Out with C++: Early Objects (9th Edition)
- Fix the mistakes in the following program so it runs as expected. There are 5 mistakes. All literals (such as 3.5) have the correct value and data type. // Java program by [Student name] [Today's date] public class Mistakes { public static void main(String[] args) { / This is a comment int z = 3.5; System.out.println("z is + z"); int s2 = "Michael"; System.out.println("s2 has the value " s2); } } Please show the mistakes clearly and how the change is made.arrow_forwardConvert this Java Program below into simplest form. It should still produce the same result as indicated in the picture. CODES: import java.util.Scanner public class Main { public static void main(String[] arg){ //declaration String lname, fname, dtype, ltype; int dcode, lcode; double lfee, dfee, tfee; //assigning data dtype = "Special"; ltype="Citywide"; dfee=30.50; //input System.out.printf("\n"); Scanner in = new Scanner(System.in); System.out.printf("Lastname of Sender: "); lname = in.nextLine(); System.out.printf("Firstname of Sender: "); fname = in.nextLine(); System.out.printf("Deliver Code: "); dcode = in.nextInt(); System.out.printf("Letter Fee: "); lfee = in.nextFloat(); //compute tfee = lfee + dfee; //display System.out.printf("\n\n\n"); System.out.printf("Sender Name: %s %s \n", fname, lname); System.out.printf("Delivery Name: %d \n", dcode); System.out.printf("Delivery Type: %s \n", dtype);…arrow_forwardIdentify the errors in the following program. 2 errorspublic class Test {public static void main(String[] args) {nPrintln(5, "Welcome to Java!");}public static void nPrintln(String message, int n) {for (int i = 0; i < n; i++) {System.out.println(message);}return n;}}arrow_forward
- What is the output of the following program and show all your workings? public class Main{public static void main(String[] args) {System.out.printin(mystery(5));}static int mystery(int num){if(num <= 1)return 1;else{return mystery(num-1) + mystery(num—2) ;}arrow_forwardAnalyze the following code.public class Test { public static void main(String[] args) { System.out.println(m(2)); } public static int m(int num) { return num; } public static void m(int num) { System.out.println(num); }} What can you say about the above code? Does it run? Does it compile? Any output?arrow_forwardPlease help me solve this with java .... just the HangMan HangMan instruction class : • HangMan is a game in which a player tries to guess a word based on a given hint. For example, if the given hint is “movie”, then the player must guess a movie name. If the given hint is a “country”, then the player must guess a country name, and so on.• The game starts by showing a message on the screen that shows the hint and all letters in the word but obscured as dashes (-). Then, the game will allow the player to guess 5 letters. If the player gives a letter that actually exists in the word, then this letter will be revealed. Afterwards, the game will ask the player to give the answer. If the given answer is correct, then the game will show a message that the player has won 5 points. Otherwise, the game will show a message that the player has lost. Below is one possible game scenario, in which the word is “iron man”, and the hint is “movie”. Note that the text in green color is the…arrow_forward
- **JAVA DEBUGGING** The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. public classDebugSeven3 { public static void main(String[] args) { String quote = "Honesty is the first chapter in the book of wisdom. - Thomas Jefferson"; System.out.println("index.of('f') is: " + quoteindexOf('f')); System.out.println("index.of('x') is: " + quoteindexOf('x')); System.out.println("char.At(5) is: " + quote.charAt(50)); System.out.println("endsWith(\"daughter\") is: " + quote.endsWith("daughter")); System.out.println("endsWith(\"son\") is: " + quote.endsWith("son")); System.out.println("replace('e', '*') is: ", quote.replace('e', '*')); } }arrow_forwardclass Output{public static void main(String args[]){int x = 3.14;int y = (int) Math.abs(x);System.out.print(y);}} The output of the above Java code is ?arrow_forwardFill with appropriate java keywords/syntaxes in the following method overloading program. package analyze; class { method (double X, double Y, double Z){ return X * Y * Z; } double method (double M, double ) { return M / N; } public class Analyze { public static void main(String[] args) { Find fi = Find(); System.out.println( Method 1 : "+fi.method(2, 4, 6)); System.out.println("Method 2 : "+fi.method(3, 6)); } }arrow_forward
- Find the output of the following code public class Q6{public static void main(String[] arg){ double a=11.5; double b=0.5;System.out.println(a+b+”FF”); }}arrow_forwardPlease help me in fixing the errors in this java program. Then proceed in putting graphics like in the photos below Program is below // A simple program to demonstrate // Tic-Tac-Toe Game. import java.util.*; public class Main { static String[] board; static String turn; // CheckWinner method will // decide the combination // of three box given below. static String checkWinner() { for (int a = 0; a < 8; a++) { String line = null; switch (a) { case 0: line = board[0] + board[1] + board[2]; break; case 1: line = board[3] + board[4] + board[5]; break; case 2: line = board[6] + board[7] + board[8]; break; case 3: line = board[0] + board[3] + board[6]; break; case 4: line = board[1] + board[4] + board[7]; break; case 5: line = board[2] + board[5] + board[8]; break; case 6: line = board[0] + board[4] + board[8]; break; case 7: line = board[2] + board[4] + board[6]; break; } //For X winner if (line.equals("XXX")) { return "X"; } // For O winner else if (line.equals("OOO")) {…arrow_forwardBelow is a java program to find roots of quadratic equation. Please explain each line of code if what it does in the program when executed. Example: Java Program to Find Roots of a Quadratic Equation public class Main { public static void main(String[] args) { double a = 2.3, b = 4, c = 5.6; double root1, root2; double determinant = b * b - 4 * a * c; if (determinant > 0) { root1 = (-b + Math.sqrt(determinant)) / (2 * a); root2 = (-b - Math.sqrt(determinant)) / (2 * a); out.format("root1 = %.2f and root2 = %.2f", root1, root2); } else if (determinant == 0) { root1 = root2 = -b / (2 * a); out.format("root1 = root2 = %.2f;", root1); } else { double real = -b / (2 * a); double imaginary = Math.sqrt(-determinant) / (2 * a); out.format("root1 = %.2f+%.2fi", real, imaginary); out.format("\nroot2 = %.2f-%.2fi", real, imaginary); } } }arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education