public static int createMirror(String str) write your code to calculate the number of characters that should be removed from a string so that it becomes a mirrored word. dont use 3rd party libraries and java.util
Q: How do I fix the error? Error ---------- Movie.toString() returns: Movie: [ Minutes 142 |…
A: Solution: Given, instead of: Movie: [ Minutes 142 | Movie Name: The Shawshank Redemption | not kid…
Q: What will be displayed as a result of executing the following code? int x = 5; int x = 5;String msg…
A: Based on Java
Q: Can you change the code below to remove the repeated lines of code and use a loop to draw 4 sides of…
A: Below is the required code to avoid repetition:
Q: Java - Create a flowchart and write the method signature for the following: a. A method that takes a…
A: Method signature: Returns an array of ints with 13 places from a string of 13 digits. int[]…
Q: public static String reverseVowels(String text) Given a text string, create and return a new string…
A: Given data is shown below:
Q: Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the…
A: Solution: Given,
Q: there a reason why the system takes off the first letter of the name when it shows the user with the…
A: Here have to determine about output correction of c++ code.
Q: Why am I getting errors? Says "Index 0 out of bounds for length 0" public static void…
A: Question- You are getting error as their are no arguments for arr. You are using args[0],args[1]…
Q: can you please write in java.util.scanner form and can you make it so i can copy and past it please…
A: Scanner class is used for accepting some input values and thus you use this in inputting values into…
Q: This is a debugging question I am struggle with - The files provided in the code editor to the…
A: In "DebugTen1.java" file, The function name should be "main()", and not "mane()". The function…
Q: Java) What will the following display to the console? Work out the solution by hand (don't run the…
A: Before writing the output and explaining it. We must know, how StringBuilder append() methods and…
Q: Hi. I need help. I need this code to be rephrased or reworded so that it won't look like copied?…
A: The given code basically tells about how we can swap an array and then display array.Code consist of…
Q: public static void doubleArray(int[] a){ int[] newA - new int[a.length]; for (int i = 0; i <…
A: Time complexity defines the worst case running time of the given program. It is denotes as O() -…
Q: Q1: Print an Array Explain in detail in English how the following outputArr method works? public…
A: - According to the restrictions placed on us because of our guidelines we are allowed to anser the…
Q: Given a list of ints and an int, all should return a bool indicating whether or not all the ints in…
A: According to the Question below the Solution: Output:
Q: please remove break to exit the loop. Find another way to exit loops without using breaks in the…
A: Required: please remove break to exit the loop. Find another way to exit loops without using breaks…
Q: m the sting library
A: given- Q1. Write method for string library? How can import the system the sting library?
Q: make a different version of this code with the same functions as i can not use my teacher's code
A: Please check the step 2 & 3 for solution
Q: What method of the Character class is used to change a given character value to a capital letter if…
A: Answer: w. toUpperCase
Q: public static String pancakeScramble(String text) This nifty little problem is taken from the…
A: Code: public class Scramble { public static void main(String[] args) {…
Q: // Application allows user to enter a series of words // and displays them in reverse order import…
A: // Application allows user to enter a series of words// and displays them in reverse orderimport…
Q: How should I add a main to the Java code? import java.util.*; import java.util.Arrays; public…
A: You can add the main method in your after the last method which is boolean equal method. Below I add…
Q: public static void main(String[] args) { // create two circle objects Circle circlel - new Circle();…
A: The complete Java code is as follows:
Q: How do I make the code work? Code: import java.util.*; import java.util.Arrays; public class…
A: Algorithm: for (initialExpression; testExpression; updateExpression){ // body of the…
Q: 2. Create a Java project named clsProject2 Create a method called public static String [][]…
A: Import the required classes from io package like File and Scanner class. Method get_years-quarters…
Q: Write an Java application that counts the total number of spaces contained in a quote entered by the…
A: Java program to count the total number of spaces contained by the quote entered by the user. The…
Q: Is the character repeating problem Within the Utils class that is provided to you in "Requested…
A:
Q: An array of String objects is Mutable O True O False
A: The correct answer of the questions is Option("True")
Q: How do I fix the Java code errors? Code: //import java.util.Arrays; //Movie.java package movie;…
A: **The program is working perfectly fine in BlueJ software. I am attaching below the screenshot of…
Q: Java Write an executable program that has just a main method. In main: create an instance of…
A: In main function: create an instance of StringBuilder that initially holds an empty string. append…
Q: Code with comments and output screenshot. Thank you!! Write a java method that receives a string…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: How do I remove the space at the end of the result? Code: import java.util.Scanner; public class…
A: The only way we can avoid the final space is we have to iterate till last but one word and then…
Q: Write a method public static intreadInFile(String line, File file) that returns the position…
A: Program Plan: Import necessary libraries required for file creation,BufferedReader,IOException and…
Q: Write a program called Guests.java that prompts a user to enter how many guests he will host. Next,…
A: Step-1: StartStep-2: Print message "Enter the number of Guests on the List:"Step-3: Declare an…
Q: How do I add, If s is null, the method should return null. If s is the blank string, “”, the method…
A: import java.util.Scanner;public class replaceFirst { public static String…
Q: 7 public static void start() 8 Scanner input = new Scanner(System.in); 10 11 String [Unumbers= {"2",…
A: Corrections: Import required libraries. Below libraries are required in the program to use Scanner…
Q: Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces.…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: get_longest_word: takes in a sentence as a string argument (string with words separated by…
A: Logic:- use loop to compare each word with other by using for loop. for word in…
Q: For the ReadWords class that is used to read the content of a given text file, which of the…
A: ANSWER C) public ReadWords() throws FileNotFoundException {...}
Q: n java #6 - program that reads the name data from the files named firstNames.txt and lastNames.txt…
A: Here is the code in Java ,I am printing first 1000 entries with comments
Q: For the ReadWords class that is used to read the content of a given text file, which of the…
A: Reason: Constructors don't want a return type specified. That is, a constructor returns the class…
Q: Write an O(n) time program that prompts the user to entertwo strings and tests whether the second…
A: Since the Programming language is not mentioned in the question, we will answer this question in…
Q: How do I make the code run properly? Code: import java.util.*; import java.util.Arrays;…
A: Solution: You didn't given any instructions to comply the code please put the instructions and…
Q: Write Java statements that finds the total of the lengths of strings in an array of strings. Do not…
A: In step 2, you will get the Java statements that find the total of the lengths of strings in an…
Q: This is the question - Write an application that accepts any number of String values from a user…
A: import java.util.*;public class StringSort2 { public static void main(String[] args) { Scanner…
Q: Fill in the missing parts of the Javadoc comment for the below method: /** * Returns the last…
A: First two boxes: Declares a string variable. Assigns a value to the variable. Last box: Call…
Q: You may use any of the libraries that we have considered in this course (either algs4.jar or…
A: import java.util.HashMap; import java.util.Map; import java.util.Set; public class Details {…
Q: How do I fix the Java code? Error: FAILED ---- numCastMembers expected: 0 Code: import…
A: //Movie.java import java.util.Arrays; public class Movie { private String movieName; private…
Q: Write a method that finds the number ofoccurrences of a specified character in a string using the…
A: PROGRAM STRUCTURE: Import the required package. Start the definition of the main public class.…
Q: public static void main (String args[]) { try { int d = 4; int n = 20; int fraction = n / d; int g[]…
A: 1) In above Java program, we are using a try catch block to evaluate Under try block we have…
public static int createMirror(String str)
write your code to calculate the number of characters that should be removed from a string so that it becomes a mirrored word.
dont use 3rd party libraries and java.util
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
- This is the question I am stuck on - Write an application that displays the strings in the provided array alphabetically in ascending order. This is the starting code - import java.util.*; public class StringSort { public static void main(String[] args) { String[] values = {"mouse", "dog", "cat", "horse", "cow", "moose", "tiger", "lion", "elephant", "bird", "hamster", "guinea pig", "leopard", "aardvark", "hummingbird"}; } }In java, without Arrays and using only String methods ( don't use String builder) // Question 17: In MS-DOS, a file name consists of up // to 8 characters (excluding '.', ':', backslask, '?', // and '*'), followed by an optional dot ('.' character) // and extension. The extension may contain zero to three // characters. For example, 1STFILE.TXT is a valid filename. // Filenames are case-blind. // // Write and test a method that takes // in a String, validates it as a valid MS-DOS file // name, appends the extensions ".TXT" if no extension // is given (that is, no '.' appears in FILENAME), converts // the name to uppercase, and returns the resulting string // to the calling method // If fileName ends with a dot, remove that dot and do not // append the default extension. If the name is invalid, // validFileName should return null. public String validFileName(String n) { }How do I make the code run properly? Code: import java.util.*; import java.util.Arrays; public class Movie { private String movieName; private int numMinutes; private boolean isKidFriendly; private int numCastMembers; private String[] castMembers; // default constructor public Movie() { this.movieName = "Flick"; this.numMinutes = 0; this.isKidFriendly = false; this.numCastMembers = 0; this.castMembers = new String[10]; } // overloaded parameterized constructor class movie{public static void main(String args[]){Movie obj=new Movie();Movie obj1=new Movie(obj.getMovieName(),obj.getNumMinutes(),obj.isKidFriendly(),obj.getCastMembers());System.out.println("Default Constructor: "+obj.getNumCastMembers());System.out.println("Overloaded Constructor: "+obj1.getNumCastMembers());}} // set the number of minutes public void setNumMinutes(int numMinutes) { this.numMinutes = numMinutes; } // set the movie name public void setMovieName(String movieName) { this.movieName = movieName; } // set if the…
- How do I add, If s is null, the method should return null. If s is the blank string, “”, the method should return the blank string to my code? import java.util.Scanner;public class replaceFirst { public static String replaceFirst(String Str,char c) { Str = Str.substring(0,0) + c + Str.substring(0 + 1);// modified string return Str; } public static void main(String[] args) { System.out.print( replaceFirst("basant",'c')); } }Write an application that displays the strings in the provided array alphabetically in ascending order import java.util.*; public class StringSort { public static void main(String[] args) { String[] values = {"mouse", "dog", "cat", "horse", "cow", "moose", "tiger", "lion", "elephant", "bird", "hamster", "guinea pig", "leopard", "aardvark", "hummingbird"}; } } I need help with this!2. Create a Java project named clsProject2 Create a method called public static String [][] get_years_quarters(String strFile), which accepts one parameter (loanamounts.txt), and returns a 2-D array (24 rows X 2 columns). The first columns should contain the years, and the second column should contain the quarters of the processed text file.
- NEED HELP PLEASE! Write a Java program to read a text file (command line input for file name), process the text file and perform the following. Print the total number of words in the file. Print the total number of different words (case sensitive, meaning “We” and “we” are two different words) in the file. Print all words in ascending order (based on the ASCII code) without duplication. Write a pattern match method to find the location(s) of a specific word (a character string up to twelve characters, e.g. system). This method should return all line number(s) and location(s) of the word(s) found in the file. Print all line(s) with line number(s) of the file where the word is funds by invoking the method of 4). Under each output line indicate the location(s) of the first character of the matched word (refer to the output example below). Empty lines are lines, they also have their own unique line numbers. Repeat the pattern match (4 and 5 above) until user types in EINPUT. A word is…Write an application that displays the strings in the provided array alphabetically in ascending order. import java.util.*; public class StringSort { publicstaticvoidmain(String[] args) { String[] values = {"mouse","dog","cat","horse","cow", "moose","tiger","lion","elephant","bird","hamster", "guinea pig","leopard","aardvark","hummingbird"}; }6. a. Fast in java coding please. Thank you 1. Why should you use StringBuffer objects instead of String objects in aprogram that makes lot of changes to strings?2. Each of the numeric wrapper classes has a static toString method. Whatdo these methods do?
- instructions are in photo and links in photos has code which I have pasted to make it easy to copy. Below is my professor code for Sudoku #2, please make a different version of this code with the same functions as i can not use my teacher's code Sudoku #2 code import java.util.*;import java.io.*; public class MySudokuBoard {public final int SIZE = 9;protected char[][] myBoard;public MySudokuBoard(String theFile) {myBoard = new char[SIZE][SIZE];try {Scanner file = new Scanner(new File(theFile));for(int row = 0; row < SIZE; row++) {String theLine = file.nextLine();for(int col = 0; col < theLine.length(); col++) {myBoard[row][col] = theLine.charAt(col);}}} catch(Exception e) {System.out.println("Something went wrong :(");e.printStackTrace();}}public boolean isSolved() {if(!isValid())return false;Map<Character,Integer> map = new HashMap<>();for(char[] row : myBoard) {for(char cell : row) {if(map.containsKey(cell))map.put(cell, map.get(cell) + 1);elsemap.put(cell, 1);}}//…need help finishing/fixing this java code so it prints out all the movie names that start with the first 2 characters the user inputs the code is as follows: Movie.java: import java.io.File;import java.io.FileNotFoundException;import java.util.ArrayList;import java.util.Scanner;public class Movie{public String name;public int year;public String genre;public static ArrayList<Movie> loadDatabase() throws FileNotFoundException {ArrayList<Movie> result=new ArrayList<>();File f=new File("db.txt");Scanner inputFile=new Scanner(f);while(inputFile.hasNext()){String name= inputFile.nextLine();int year=inputFile.nextInt();inputFile.nextLine();String genre= inputFile.nextLine();Movie m=new Movie(name, year, genre);//System.out.println(m);result.add(m);}return result;}public Movie(String name, int year, String genre){this.name=name;this.year=year;this.genre=genre;}public boolean equals(int year, String genre){return this.year==year&&this.genre.equals(genre);}public String…How do I make the code work? Code: import java.util.*; import java.util.Arrays; public class Movie { private String movieName; private int numMinutes; private boolean isKidFriendly; private int numCastMembers; private String[] castMembers; // default constructor public Movie() { this.movieName = "Flick"; this.numMinutes = 0; this.isKidFriendly = false; this.numCastMembers = 0; this.castMembers = new String[10]; } // overloaded parameterized constructor public Movie(String movieName, int numMinutes, boolean isKidFriendly, String[] castMembers) {this.movieName = movieName;this.numMinutes = numMinutes;this.isKidFriendly = isKidFriendly;this.numCastMembers=0;this.castMembers=new String[castMembers.length];for(int i=0;i<castMembers.length;++i){this.castMembers[i] = castMembers[i];if(castMembers[i]!=null)this.numCastMembers++;} }// set the number of minutes public void setNumMinutes(int numMinutes) { this.numMinutes = numMinutes; } // set the movie name public void setMovieName(String…