Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1.9, Problem 1.9.1CP
Reformat the following program according to the
public class Test
{
// Main method
public static void main(String[] args) {
/** Display output */
System.out.println(“Welcome to Java”);
}
}
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Whether it's true or not
For example, we may select whether to enter or exit a specific method call in the debugger.
Debuggers, tests, and println() statements are all acceptable methods to discover problems in our code.
True or False:
(a) In a debugger, we can choose whether to step into, step over, or step out of a particular method call.
(b) Debuggers, tests, and println() statements are all legitimate ways to help us find errors in our code.
JAVA Program ASAP
Please modify this program and take out the main method from the program so it passes the test cases in Hypergrade. I have provided the failed test cases.
import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.InputMismatchException;import java.util.Scanner;public class FileSorting { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { System.out.println("Please enter the file name or type QUIT to exit:"); String fileName = scanner.nextLine(); if (fileName.equalsIgnoreCase("QUIT")) { break; } try { ArrayList<String> lines = readFile(fileName); if (lines.isEmpty()) { System.out.println("File " + fileName + " is empty."); } else { performSorting(lines);…
Chapter 1 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 1.2 - What are hardware and software?Ch. 1.2 - List the five major hardware components of a...Ch. 1.2 - What does the acronym CPU stand for? What unit is...Ch. 1.2 - Prob. 1.2.4CPCh. 1.2 - What is memory for? What does RAM stand for? Why...Ch. 1.2 - Prob. 1.2.6CPCh. 1.2 - Prob. 1.2.7CPCh. 1.3 - What language does the CPU understand?Ch. 1.3 - What is an assembly language? What is an...Ch. 1.3 - What is a high-level programming language? What is...
Ch. 1.3 - What is an interpreter? What is a compiler?Ch. 1.3 - Prob. 1.3.5CPCh. 1.4 - Prob. 1.4.1CPCh. 1.4 - Prob. 1.4.2CPCh. 1.4 - Prob. 1.4.3CPCh. 1.5 - Who invented Java? Which company owns Java now?Ch. 1.5 - What is a Java applet?Ch. 1.5 - What programming language does Android use?Ch. 1.6 - What is the Java language specification?Ch. 1.6 - Prob. 1.6.2CPCh. 1.6 - Prob. 1.6.3CPCh. 1.6 - Are tools like NetBeans and Eclipse different...Ch. 1.7 - What is a keyword? List some Java keywords.Ch. 1.7 - Prob. 1.7.2CPCh. 1.7 - Prob. 1.7.3CPCh. 1.7 - Prob. 1.7.4CPCh. 1.7 - Prob. 1.7.5CPCh. 1.8 - What is the Java source filename extension, and...Ch. 1.8 - What are the input and output of a Java compiler?Ch. 1.8 - What is the command to compile a Java program?Ch. 1.8 - What is the command to run a Java program?Ch. 1.8 - Prob. 1.8.5CPCh. 1.8 - Prob. 1.8.6CPCh. 1.8 - If a NoClassDefFoundError occurs when you run a...Ch. 1.8 - If a NoSuchMethodError occurs when you run a...Ch. 1.9 - Reformat the following program according to the...Ch. 1.10 - Prob. 1.10.1CPCh. 1.10 - Prob. 1.10.2CPCh. 1.10 - If you forget to put a closing quotation mark on a...Ch. 1.10 - If your program needs to read integers, but the...Ch. 1.10 - Suppose you write a program for computing the...Ch. 1.10 - Identify and fix the errors in the following code:...Ch. 1 - (Display three messages) Write a program that...Ch. 1 - (Display five messages) Write a program that...Ch. 1 - (Display a pattern) Write a program that displays...Ch. 1 - Prob. 1.4PECh. 1 - (Compute expressions) Write a program that...Ch. 1 - (Summation of a series) Write a program that...Ch. 1 - (Approximate ) can be computed using the...Ch. 1 - (Area and perimeter of a circle) Write a program...Ch. 1 - (Area and perimeter of a rectangle) Write a...Ch. 1 - (Average speed in miles) Assume that a runner runs...Ch. 1 - (Population projection) The U.S. Census Bureau...Ch. 1 - (Average speed in kilometers) Assume that a runner...Ch. 1 - (Algebra: solve 2 2 linear equations) You can use...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write code that lets the user enter a number. The number should be multiplied by 2 and printed until the number...
Starting Out with C++: Early Objects
What are the advantages and disadvantages of implicit declarations?
Concepts of Programming Languages (11th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
Define a class for a type called CounterType. An object of this type is used to count things, so it records a c...
Problem Solving with C++ (10th Edition)
What is the output produced by the following lines of program code? int quotient = 7/3; int reminder = 7/3; Sys...
Java: An Introduction to Problem Solving and Programming (8th Edition)
The ________ object is assumed to exist and it is not necessary to include it as an object when referring to it...
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
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
- Q 1: Write a complete Java program with your own code writing that contains:- A main method- A loop: for, while, or do-while- A selection: if-else or switch- Variables that have different scopes (main, loop, if, etc.)- A constant literalQ2: Test your program. Ensure that it runs correctly (syntax error free).Q3: Identify the scope(s) of each variable in your Java program.arrow_forwardDetermine the output for the following code. Box in your final output result. public class Beta extends Baap { public int h = 44; public int getH( ) { System.out.println("Beta " + h); return h; } public static void main(String[ ] args) { Baap b = new Beta(); System.out.println(b.h + " " + b.getH( )); Beta bb = (Beta) b; System.out.println(bb.h + " " + bb.getH( )); } } public class Baap { public int h = 4; public int getH( ) { System.out.println("Baap " + h); return h; } }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_forward
- Please convert this Java code to Pseudocode and decoder method : public String encoder (String text , int key) { char[] uCase = { 'A','B' , 'C', 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; char[] lCase = { 'a' , 'b' , 'c', 'd','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; String cipher = " "; for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (char.isUpperCase(c)) { for (int j = 0; j < uCase.length; j++) if (c.equals(uCase[j]) ) { cipher = cipher + uCase[(j+key)]; } } else { for (int j = 0; j < lCase.length; j++) { if (c.equals(lCase[j])) cipher = cipher+ lCase[(j+key)]; } } } return cipher ; }arrow_forwardShow the output of the following programs. (Hint: Draw a table and list the variables in the columns to trace these programs.) (java language)(a)public class Test {public static void main(String[] args) {for (int i = 1; i < 5; i++) {int j = 0;while (j < i) {System.out.print(j + " ");j++;}}}} (b)public class Test {public static void main(String[] args) {int i = 0;while (i < 5) {for (int j = i; j > 1; j--)System.out.print(j + " ");System.out.println("****");i++;}}} (c)public class Test {public static void main(String[] args) {int i = 5;while (i >= 1) {int num = 1;for (int j = 1; j <= i; j++) {System.out.print(num + "xxx");num *= 2;} System.out.println();i--;}}} (d)public class Test {public static void main(String[] args) {int i = 1;do {int num = 1;for (int j = 1; j <= i; j++) {System.out.print(num + "G");num += 2;} System.out.println();i++;} while (i <= 5);}}arrow_forwardThe type of recursion implemented in the following code is a tail recursion (True or False) ? Please explain/ justify your answer. public class ClassTest { public int test(int val) { if (val <= 0){ return val +1; } else return test(val-1) - test(val-2); } public static void main(String[] args) { ClassTest obj = new ClassTest(); int result = obj.test(4); System.out.println("Output is: " + result); } }arrow_forward
- public static void displayValue(int x, int y) Fill-in-the-blank for this call to the above method: ________________(10, 15);arrow_forwardpractice JAVA program that inputs a string from the user and prints a copy of the string with the first character of each sentence capitalized. (No need to consider strings with punctuation marks other than a period.) NOTE: For string and character manipulation, you should use only the String and Character methods (and not methods of other API classes) HINT: To split a string with “. “ delimiter, pass the following expression to the split method: “\\. “ String methods split, charAt, and substring, and Character method toUpperCase can be helpful.arrow_forwardThis is a debugging problem I am stuck on - 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. This is the code - import java.util.*; public class DebugNine2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); Movie[] movies = new Movie[8]; int i; String message, entry; movies[0] = new Movie("The Godfather", 1972); movies[0] = new Movie("The Good, the Bad, and the Ugly", 1966); movies[0] = new Movie("Pulp Fiction", 1994); movies[0] = new Movie("Shindler's List", 1993); movies[4] = new Movie("Casablanca", 1942); movies[5] = new Movie("Wizard of Oz", 1939); movies[6] = new Movie("Citizen Kane", 1941); movies[7] = new Movie("Some Like It Hot", 1959); System.out.println( "Sort Movies by\n(N)ame, or (Y)ear");…arrow_forward
- java, write simple program use the following method: getMin: takes three integers as arguments and returns the minimum value of the three.arrow_forward1) Demonstrate the use of overloaded methodseach has three primitive parameters two methods computes and returns the product to the calling method for printing one method computes and prints the product; does not return a result Note:- Please type and execute the above java program and also need an output for this program as soon as possible. (type a java program)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_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
The Top Down Approach to Software Development; Author: Christopher Kalodikis;https://www.youtube.com/watch?v=v9M8LA2uM48;License: Standard YouTube License, CC-BY