This is the code that needs to be corrected: // This application gets a user's name and displays a greeting import java.util.Scanner; public class DebugThree3 { public static void main(String args[]) { String name; name = getName(); displayGreeting(name); } public static String getName(name) { String name; Scanner input = new Scanner(System.in); System.out.print("Enter name "); name = input.nexlLine(); return name; } public static displayGreeting(String name) { System.outprintln("Hello, " + name + "!"); } }
Q: In this java program, please explain everyline of this code. Thank youuuuuuuuuuu
A: here in the given question ask for comment out given program.
Q: Modify the Java CountByFives application so that the user enters the value to count by. Start each…
A: public class CountByAnything{ public static void main (String args[]) { final int START…
Q: public class ReversedDigit { public static void main(String[] args) { Scanner scan =…
A: The do-while loop is a variant of the while loop.
Q: |import java.util.Scanner; public class AssignmentFive { public static void main(String[] args) {…
A: package assignments;import java.util.Scanner;public class AssignmentFive { public static void…
Q: What will the following program display?public class ReviewQuestion5{public static void…
A: Here the function myMethod is using recursion. That is the function will call itself with one value…
Q: public class FirstEx_2ExplainCodes { static int counterObj= 0; public double salary = 0; public…
A: EXPLANATION: - class FirstEx_2ExplainCodes comprises of following variables: - static integer…
Q: Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 4…
A: 1. Take two inputs from the user. 2. Write the if condition for userNum1. 3. Write the if condition…
Q: Write a pesudocode for the following code: public class EOM1 { public static void main(String[]…
A: The above java code is indicating a transaction between customer and the salesman. The customer buys…
Q: class Excep { public static void main(String[] args){ try{ int arr[]=(1,2}; int x = arr[1]/arr[0]-1;…
A: Define class Excep. Define main function. Define try block. Define array arr with values 1 and 2.…
Q: Below is the CustomerNumber Program. In the attached pictures is the assignment I am struggling…
A: import java.util.Scanner; public class CustomerNumber{ public static void main(String[] args){…
Q: The Double.parseDouble() method requires a String argument, but it fails if the String cannot be…
A: NumberFormatException: The numeric wrapper classes “parse” methods all throw a…
Q: class Test { private int a; private int b; public Test() { a = 5; b = a - 3; }…
A: The above code contains no error. The program conatins a class named Test with two data members.…
Q: exercise 2: Write a program that counts the letters in a user provided String. The program should…
A: Sample Response: //Java program to ocunt the number of letters in a user input stringpackage…
Q: public class output{ public static int find (int a1, int a2) { if(a1==0) return(a1+1); else if(a1>0…
A: There is a class output in which two method are there find and main. Find method is recursively…
Q: public class output{ public static int check (int a, int b, int c) { if(a==0) return (b); else if…
A: Given:
Q: There is an ERROR in this code: import java.util.Scanner; public class TestPhoneBook { public…
A: Solution: Corrected code: Note: changes made shown with bold in code- TestPhoneBook.java…
Q: $452 converted is 22 $20s, 1 $10s, 0 $5s, and 2 $1s.
A: Add space in the print statement and add the dollar sign in the print statement
Q: Write a program that asks the user to enter a year, and then displays whether that year is a leap…
A: A year is said to be a leap year if the year satisfies the following conditions If the year is…
Q: C:\>javac TestBookingJO.java C:\>java Test BookingJO Total Booking O Total payment received:RM 900.0…
A: The program is written in Java. In this program, I added a new alert box at the end of the program.…
Q: Write an if-else statement for the following: If userTickets is less than 6, execute award Points =…
A: Your given program is logically correct but the issue is in the closing of blocks. Blocks were…
Q: Write an expression that prints "Special number" if specialNum is -99, 0, or 44. 1 import…
A: File name: “FindSpecialValue.java” import java.util.Scanner; public class FindSpecialValue {…
Q: ow to make it the number a row? Can someone fix the code given below:
A: Required: How to make it the number a row? Can someone fix the code given below:
Q: A contact list is a place where you can store a specific contact with other associated information…
A: In java if you are reading input with .next method then you will read string till first '\n'…
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 class CircleAndSphereWhileLoop 3 { public static final doubl MAX_RADIUS = 500.0; 14 %3D 15…
A: In this program we have to perform a mathematics calculation for Area of circle Circumference of…
Q: The String class is provided in the Java library.Provide your own implementation for the following…
A: Program structure Import class Arrays from the util package in the program. Create a Main class…
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: DebugEight4: Here is the code that needs to be debugged, I fixed some but it will not display the…
A: import java.util.*; class Main { public static void main(String[] args) { Scanner input = new…
Q: In this java program please run and explain the output, thank you Source Code: import…
A: import java.util.Scanner;public class Main { public static void main(String[] args) {…
Q: Please write the script and introduction for the program so that the number of words is between…
A: We need to write an introduction and functionality for the given program.
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: public class AverageWithSentinel public static final int END_OF_INPUT = -500'; %3D public static…
A:
Q: This tests the Time class, which is used to store a time of day and output it. It also stores the…
A: There are many ways to get current date and time in java. There are many classes that can be used to…
Q: public class JavaApplication7 { public static void main(String [] args) { //TODO - write your own…
A: public class Main{ public static void main(String[] args) { //testing method…
Q: public class TestAverage {public static void main(String[] args) {int test1, test2, test3,…
A: The objective of the program is to calculate the average, now since the variable which holds the…
Q: Start with the code below and complete the getInt method. The method should prompt the user to enter…
A: throw is the keyword used to explicitly throw an Exception
Q: public class MaxMinAtLeastOneValue public static void main(String[] args) { Scanner in = new Scanner…
A: - We have to code for the java program of min, max and count values.
Q: Here is the question: Write an application that counts the total number of spaces contained in a…
A: import java.util.*; public class CountSpaces2{ public static void main(String[] args) {…
Q: The output of the above Java code is ?
A: Given, Code: class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67,…
Q: public class RandomNumbersWithASeed { // The specified seed public static final int SEED = 146; //…
A: Modified code: import java.util.*;public class RandomNumbersWithASeed { public static final int…
Q: import java.util.* ; public class MaxFinder { public static void main(String[] args) {…
A: Given: import java.util.* ; public class MaxFinder { public static void main(String[] args)…
Q: Debug this program to create the desired result attached in the picture. public class Library { //…
A: Here I have defined a static class named Book with one data member and constructor inside the class…
Q: Java
A: import java.util.Scanner; public class WordProperties { public static void…
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: Please make a JAVA PROGRAM of this problem (See attached photos below) Program it simple if possible…
A: FLAMES game using JavaIn this post we are going to see Java code for flames game. This is one of the…
Q: Can u make this into Java. Util. Scanner and not Joptionpane and make methods for everything and…
A: util is the package name Scanner is the class inside this util package which is used to accept the…
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: Hello! Can you help debug my Java program? I'm writing a program to convert Celsius to Farenheit.…
A: Program: //import the header file import java.util.Scanner; //definition of class public…
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…
This is the code that needs to be corrected:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Below is the CustomerNumber Program. In the attached pictures is the assignment I am struggling with. import java.util.Scanner; /** * This program tests a customer number to determine * whether it is in the proper format. */ public class CustomerNumber { public static void main(String[] args) { String customer; // To hold a customer number // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); System.out.println("Enter a customer number in " + "the form LLLNNNN"); System.out.print("(LLL = letters and NNNN " + "= numbers): "); // Get a customer number from the user. customer = keyboard.nextLine(); // Determine whether it is valid. if (isValid(customer)) { System.out.println("That's a valid customer " + "number."); } else { System.out.println("That is not the proper " + "format."); System.out.println("Here is an example: " + "ABC1234"); } } /** * The isValid method accepts a String as its argument * and tests its contents for a valid customer number.…Here is the question: Write an application that accepts three Strings from the user and displays them in alphabetical order without regard to case. Here is the code so far just needs to be altered: import java.util.*; public class Alphabetize2 { public static void main(String[] args) { String str1, str2, str3; Scanner in = new Scanner(System.in); System.out.print("Enter first string >> "); str1 = in.nextLine(); System.out.print("Enter second string >> "); str2 = in.nextLine(); System.out.print("Enter third string >> "); str3 = in.nextLine(); // display strings in alphabetical order if(str1.toLowerCase().compareTo(str2.toLowerCase()) < 0 && str2.toLowerCase().compareTo(str3.toLowerCase()) < 0) System.out.println("You entered the strings in alphabetical order"); else System.out.println("You did not enter the words in alphabetical order"); } }import java.util.*; public class CardGame { static Scanner scanner = new Scanner(System.in); static Random random = new Random(); public static void main(String[] args) { System.out.println("Welcome to the card game! Here are the instructions:"); System.out.println("- You will randomly draw a card from a deck of 52 cards."); System.out.println("- The computer will also draw a card from the same deck."); System.out.println("- If your card has a higher face value, you win. Otherwise, you lose."); System.out.println("- If your card has the same face value as the computer's card, the suit determines the order."); int gamesPlayed = 0; int userWins = 0; int computerWins = 0; boolean[] cards = new boolean[52]; // false means the card is available, true means it's been drawn while (true) { System.out.println("\nNew game!"); int[] userCard = drawCard(cards); int[]…
- What will the following program display?public class ReviewQuestion5{public static void main(String[] args){int x = 10;System.out.println(myMethod(x));}public static int myMethod(int num){if (num <= 0)return 0;else return myMethod(num − 1) + num; }}This is the question - 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. This is the code I have but it is wrong becuase I didn't get a single check right - import java.util.*; public class StringSort2 { public static void main(String[] args) { // Write your code here Scanner sc = new Scanner(System.in); String s = ""; System.out.print(""); ///loop works until string input is zzz or string length is greater than 15 while (true){ String input = sc.nextLine(); if(input.equalsIgnoreCase("zzz") || input.length()>15) break; s=input; } } }(in java) add a part where you print user information and update the continue watching list in program 2 Program 1: class Netflix {public String movies[] = new String[10];public String trendingTop5[] = new String[5];public String continueWatching[] = new String[5];public String username;public String password;private boolean isAuthenticated;public double balance;public int subscriberSinceYear;public void logininfo() {Scanner input = new Scanner(System.in);System.out.println("Enter the username");String username = input.nextLine();System.out.println("Enter the password");String password = input.nextLine();boolean isAuthenticated = true;System.out.println(isAuthenticated + " , You have successfully logged in ");System.out.println();}public void trendingList() {Scanner input = new Scanner(System.in);String[] items = new String[5];System.out.println("Enter the top 5 trending item of the week");int i;for (i = 0; i < 5; ++i) {items[i] =…
- Continuing from the example, modify the program so that it outputs the average grade in each course, and also shows which course has the highest average grade. import java.util.Scanner; public class Main { publicstaticvoid main(String[] args) { Scanner s = new Scanner(System.in); int numCourses, numTests; double[][] testScores; System.out.print("How many courses are you taking? "); numCourses = s.nextInt(); testScores = new double[numCourses][]; // allocate an array of references to 1-D arrays (rows) for(int i = 0; i < numCourses; i++) { System.out.print("How many tests are in course number " + (i+1) + "? "); numTests = s.nextInt(); // allocate this row: a 1-D array of doubles: testScores[i] = new double[numTests]; } for(int courseId=0; courseId < testScores.length; courseId++) { for(int testId=0; testId < testScores[courseId].length; testId++) { System.out.print("What was your grade on test " + (testId+1) + " for course " + (courseId+1) + "? ");…Write an application that asks a user to enter an integer. Display a statement that indicates whether the integer is even or odd. import java.util.Scanner; class EvenOdd { public static void main(String[] args) { // Write your code here } public static boolean isEven(int number) { } }I need this debugged. Thanks in advance. // Application allows user to enter a series of words// and displays them in reverse orderimport 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 = newStringBuffer("The words in reverse order are\n");System.out.println("Enter any word" +"Enter + STOP + when you want to stop");entry = input.next();while(!(entry.equals(STOP))){array[x] = entry;++x;System.out.println("Enter another word" +"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);}}
- When the given integer variable numberOfTools is: less than 14, output "Small tool box". between 14 inclusive and 39 inclusive, output "Mid-sized tool box". greater than 39, output "Need wall storage". End with a newline. Ex: If the input is 13, then the output is: (in java) Given Code: import java.util.Scanner; public class ToolDetails {public static void main(String[] args) {Scanner scnr = new Scanner(System.in);int numberOfTools; numberOfTools = scnr.nextInt();This is the question - Write an application that prompts a user for a month, day, and year. Then display the appropriate message: Y is not this year M was a month earlier this year M is a month later this year M is this month This is the code I have for it so far - import java.util.*; import java.time.*; public class PastPresentFuture { public static void main (String args[]) { LocalDate today = LocalDate.now(); LocalDate enteredDate; int mo, da, yr; int todayMo, todayDa, todayYr; Scanner input = new Scanner(System.in); System.out.print("Enter a month >> "); mo = input.nextInt(); System.out.print("Enter a day >> "); da = input.nextInt(); System.out.print("Enter a year (four digits) >> "); yr = input.nextInt(); } }Write 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 } }