Write an application that accepts any number of String values from a user until they enter zzz or have entered 15 strings, and display them in ascending order.
Q: Write a program that takes a first name as the input, and outputs a welcome message to that name Ex:…
A: Code : import java.util.Scanner; public class LabProgram { public static void main(String[]…
Q: This is a debugging problem I am stuck on - The files provided in the code editor to the right…
A: // Looks up author of selected booksimport java.util.*;class DebugNine1{ public static void…
Q: Write a program whose input is two integers, and whose output is the first integer and subsequent…
A: You have used while(true) but there is no breaking condition that's why it is going in infinite…
Q: Our system will automatically run your program several times, trying different input values to…
A: Given:
Q: do I edit the code to correctly display the number of available burgers and the waiting customers?…
A: It is defined as a high level, robust, object-oriented and secure programming language. The features…
Q: This is meant to be written in JAVA So far we've learned variables, branches, loops, and just…
A: :- The question is to create a strong password from the provided parameters.
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: What is the number of operations executed when the following Java code runs? Your answer is expected…
A: The given code is below- public class RandomSequence { public static void main ( String[] args ) {…
Q: USING JAVA Write a Java method toDecimalString() that receives a string with hexadecimal symbols…
A: here i explain with java code for your problem Hex2Dec.
Q: ould be edited in my code below to acheive the desired outcome? import java.util.Scanner; class…
A: It is defined as a general-purpose computer programming language that is concurrent, class-based,…
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A: 1. The first while-loop was not closed. 2. It will be java.lang.Math.random() instead of…
Q: Write a for loop that prints: 1 2. countNum Ex: If the input is: 4 the output is: 1 2 3 4 1 import…
A: Here I have created the variables to store the values. Next, I have taken input from the user and…
Q: Find the attached file.
A: Note: Here you didn't mention any programming language so we using the C++ programming language to…
Q: A cryptogram is a coded message using alphabet substitution. For example, the letter "A" in the…
A: Here, I am writing a python program for the decoded cryptogram.
Q: t user to enter a string Count the occurrences of digital characters, uppercase letters, and…
A: java code : import java.util.Scanner; class CountCharTypes { public static void main(String[]…
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: ANSWER:-
Q: No loops
A: The program is explained in detail with inlined comments. It uses the modulo operator % to find if…
Q: Write a program for a string is given which contains alphanumeric elements only. find the sum of…
A: Requirements :- Write a program for a string is given which contains alphanumeric elements only.…
Q: Please help me to find out why this code is error
A: There are two possible errors might happen with this program and are as follows:…
Q: N JAVA Count the number of "xx" in the given string. We'll say that overlapping is allowed, so…
A: In this question, we are asked to write a java program which return the count of 2 overlap x.…
Q: create a class that asks a user for 2 string inputs (USE The Java. Util. SCANNER) -compare the…
A: (Disclaimer: Since you have asked multiple questions, we will solve the first question for you. If…
Q: The files provided in the code editor to the right contain syntax and/or logic errors. In each case,…
A:
Q: Given a line of text as input, output the number of characters excluding spaces, periods, or commas.…
A: function main: START Read userText SET count =0. SET i=0. REPEAT STEP 5 to STEP 6 UNTIL…
Q: Write a program that will show you how the two types of print formatting works under the data type…
A: We need to perform the following : 1. Type in the Python code given. 2. Determine its output 3.…
Q: 4. Is It You, Cody? by CodeChum Admin Can you identify if Cody's name is spelled right? If so, then…
A: Java code for the given problem as follows :- import java.util.Scanner;public class MyClass {…
Q: Do you know what is wrong with my code? I want to initialize two-variable rank and suit together but…
A: You have not provided the input-output format. so if you have specific input/output in mind. please…
Q: What is the output of the following program? public class StackTest { public satic viod main(String]…
A: After for loop- 6 5 4 3 2 1 st1 After 1st while loop st1 become empty and st2 - 2…
Q: I need to write a program which allows me to input "3 Joe,123-5432 Linda,983-4123 Frank,867-5309…
A: So everything looks fine in your code. But the problem is that java file allowed only one public…
Q: The problem I have is, say I am storing the phone number and don't want their phone number to…
A: import java.util.Scanner; class Clint { private String id; private String name;…
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: 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: Write a program that generates the positions of whitespaces in a string and prints them on the…
A: Algorithm: Iterate over array check whether the character is Whitespace or not if…
Q: Write a Java program to remove any extra whitespace characters between any two words in a string.…
A: - We need to code for the extra space problem in java.
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: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: The problem with your code is it can read only one line. As question says we have to read until user…
Q: How to write a program in java that ask the user for an input word(use the String method toUpperCase…
A: Programming instructions: Declare and initialize the necessary variables. Take a word from the…
Q: Write a second convertToInches() with two double parameters, numFeet and numInches, that returns the…
A: Note: The function added in the code is along with the comments to have a better understanding of…
Q: Write a java program call CountVowelsDigits which prompts the user for a string, counts the number…
A: import java.util.Scanner;import java.lang.*;public class Main{ //method to print count and…
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: The Java code given below implements the method named showTwos that shows the factors of 2 in a…
A: Please find the answer below :
Q: THIS IS MEANT TO BE WRITTEN IN JAVA. The assignment is to get an integer from input, and output…
A: /*Get an integer from input, and output that integer squared, ending with newline.*/ import…
Q: Re-write this program using Iterators but without changing the meaning and consequently producing…
A: class TwoDArray { public static void main(String args[]) { int i, j, k = 0, twoD[][] = new…
Q: I need to write a palindrome Java program. Given a string of letters, it should find the minimum…
A: ANSWER: Palindrom: Program 1: Output:
Q: Print the two strings, firstString and secondString, in alphabetical order. Assume the strings are…
A: Program read the two strings and stores them in the two variables. It uses the below line of code to…
Q: So I have what I think the code would be but it doesn't like it. This is the question- Write a…
A: Hey, thank you very much for your question. As per your question, the information is gathered as…
Q: So, this is the question - Write a program that accepts the names of three political parties and the…
A: Hey, thank you for your question. The required task you have mentioned in the question as to write a…
Q: What should I edit or do in my code so that I will get the outcome? What could be edited in my code…
A: I have implemented the question as per given specifications. The final code is as follows: import…
Q: The String class is provided in the Java library. Provide your own Java implementation for the…
A: Explanation: charAt() The charAt () function of the Java-String class produces the character…
This is the question I am stuck on -
Write an application that accepts any number of String values from a user until they enter zzz or have entered 15 strings, and display them in ascending order.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- class Lab4Q1P3 { public static void main(String args[]) { int max = 10;while (max < 10) {System.out.println("count down: " + max);max--;}}} Do you know what is wrong with the program? I know that there is error on the 7th line but I don't know what to fix.public static String pancakeScramble(String text) This nifty little problem is taken from the excellent Wolfram Challenges problem site where you can also see examples of what the result should be for various arguments. Given a text string, construct a new string by reversing its first two characters, then reversing the first three characters of that, and so on, until the last round where you reverse your entire current stringWrite an application that counts by five from 5 through 500 inclusive, and that starts a new line after every multiple of 50 (50, 100, 150, and so on). public class CountByFives { public static void main (String args[]) { // Write your code here } }
- public static String pancakeScramble(String text) This nifty little problem is taken from the excellent Wolfram Challenges problem site where you can also see examples of what the result should be for various arguments. Given a text string, construct a new string by reversing its first two characters, then reversing the first three characters of that, and so on, until the last round where you reverse your entire current string.This problem is an exercise in Java string manipulation. For some mysterious reason, the Java String type does not come with a reverse method. The canonical way to reverse a Java string str is to first convert it to mutable StringBuilder, reverse its contents, and convert the result back to an immutable string, that is,str = new StringBuilder(str).reverse().toString(); Here's the tester it must pass: @Test public void testPancakeScramble() throws IOException {// Explicit test casesassertEquals("", P2J3.pancakeScramble(""));assertEquals("alu",…public static String pancakeScramble(String text) This nifty little problem is taken from the excellent Wolfram Challenges problem site where you can also see examples of what the result should be for various arguments. Given a text string, construct a new string by reversing its first two characters, then reversing the first three characters of that, and so on, until the last round where you reverse your entire current string. This problem is an exercise in Java string manipulation. For some mysterious reason, the Java String type does not come with a reverse method. The canonical way to reverse a Java string str is to first convert it to mutable StringBuilder, reverse its contents, and convert the result back to an immutable string, that is, str = new StringBuilder(str).reverse().tostring(); A bit convoluted, but does what is needed without fuss or muss. Maybe one day the Java strings will come with the reverse method built in, just like the string data types of all sensible…Fix the errors and send the code please // Application allows user to enter a series of words // and displays them in reverse order import java.util.*; public class DebugEight4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = 0, y; String array[] = new String[100]; String entry; final String STOP = XXX; StringBuffer message = new StringBuffer("The words in reverse order are\n"); System.out.println("Enter any word\n" + "Enter + STOP + when you want to stop"); entry = input.next(); while(!(entry.equals(STOP))) { array[x] = entry; ++x; System.out.println("Enter another word\n" + "Enter " + STOP + " when you want to stop"); entry = input.next(); } for(y = x - 1; y > 0; ++y) { message.append(array[y]); message.append("\n"); } System.out.println(message) }
- // Application allows user to enter a series of words // and displays them in reverse order import java.util.*; public class DebugEight4 { publicstaticvoidmain(String[] args) { Scanner input =newScanner(System.in); int x =0, y; String array[] =newString[100]; String entry; finalString STOP =XXX; StringBuffer message =new StringBuffer("The words in reverse order are\n"); System.out.println("Enter any word\n" + "Enter + STOP + when you want to stop"); entry = input.next(); while(!(entry.equals(STOP))) { array[x] = entry; ++x; System.out.println("Enter another word\n" + "Enter "+STOP+" when you want to stop"); entry = input.next(); } for(y = x -1; y >0; ++y) { message.append(array[y]); message.append("\n"); } System.out.println(message) }Lab Task 04: Include the methods in the file KMP_Implementation.txt in a complete Java program that prompts for and reads a text string and then a text pattern to search for in the text. It then displays the result of the search. Sample program runs: Enter the text: ABABСАВАВАВСАВАВСАВАВСАВАВКККАВАВСАВАВ Enter the pattern to search for: ABABCABAB Pattern found at these text starting indexes: 0 Enter the text: A KFUPM STUDENT Enter the pattern to search for: KFE Pattern not in text. 7 12 17 29Modify the CountByFives application so that the user enters the value to count by. Start each new line after 10 values have been displayed. public class CountByAnything { // Modify the code below public static void main (String args[]) { final int START = 5; final int STOP = 500; final int NUMBER_PER_LINE = 50; for(int i = START; i <= STOP; i += START) { System.out.print(i + " "); if(i % NUMBER_PER_LINE == 0) System.out.println(); } } }
- // Displays five random numbers between // (and including) user-specified values import java.util.Scanner; public class DebugSix4 { public static void main(String[] args) { int high, low, count = 0; final int NUM = 5; Scanner input = new Scanner(System.in); System.out.print("This application displays " + NUM + " random numbers" + "\nbetween the low and high values you enter" + "\nEnter low value now... "); low = input.nextInt() System.out.print("Enter high value... "); high = inputnextInt(); while(low < high) { System.out.println("The number you entered for a high number, " + high + ", is not more than " + low); System.out.print("Enter a number higher than " + low + "... "); high = input.nextInt(); while(count < NUM) { double result = Math.random(); int answer = (int) (result * 10 + low); if(answer <=…// Displays five random numbers between // (and including) user-specified values import java.util.Scanner; public class DebugSix4 { publicstaticvoidmain(String[] args) { int high, low, count =0; finalint NUM =5; Scanner input =newScanner(System.in); System.out.print("This application displays " + NUM + " random numbers"+ "\nbetween the low and high values you enter"+ "\nEnter low value now... "); low = input.nextInt() System.out.print("Enter high value... "); high = inputnextInt(); while(low < high) { System.out.println("The number you entered for a high number, " + high + ", is not more than " + low); System.out.print("Enter a number higher than " + low + "... "); high = input.nextInt(); while(count <NUM) { double result = Math.random(); int answer = (int) (result *10+ low); if(answer <= higher) { System.out.print(answer + " "); ++count; } } System.out.println("End of Application"); } }// DebugFive2.java // Decides if two numbers are evenly divisible import java.util.Scanner; public class DebugFive2 { publicstaticvoidmain(Stringargs[]) { int num; int num2; Scanner input =newScanner(System.in); System.out.print("Enter a number "); num = input.nextInteger() System.out.print("Enter another number "); num2 = inputnextInt(); if((num % num2 ==0) && (num2 % num) ==0) System.out.println("One of these numbers is evenly divisible into the other"); else System.out.println("Neither of these numbers is evenly divisible into the other"); } }