In this assignment you will demonstrate your knowledge by fixing the errors you find in the program below. Copy out the text from this document and fix the code. Paste the corrected code in the area below, and make a list of the problems you fixed.
Import java.util.Scanner;
public class Test1 {
public static void main(String[] args) {
Scaner input = new Scanner();
System.out.print("Enter an integer: ");
int v = Input.nextInt());
System.out.printLn("You entered " & v);
System.out,print("Enter a double: ");
double v2 = input.nextInt(),
Systems.println("You entered " & v2);
};
PUT YOUR CORRECTED CODE HERE:
LIST OF PROBLEMS FIXED:
import java.util.Scanner; // 1. should be import instead of Import
public class Test1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in); // 2. Should be Scanner instead of Scaner. 3. pass System.in as argument to Scanner constructor
System.out.print("Enter an integer: ");
int v = input.nextInt(); // 4. should be input instead of Input. 5. remove extra ) at the end of the statement
System.out.println("You entered " + v); // 6. It should be println instead of printLn. 7. use + for string concatenation instead of &
System.out.print("Enter a double: "); // 8. use . instead of ,
double v2 = input.nextDouble(); // 9. use ; to close the statement. 10. use nextDouble to read double
System.out.println("You entered " + v2); // 11. use + for string concatenation instead of &
}
} // 12. end with } instead of ;

In this assignment you will demonstrate your knowledge by fixing the errors you find in the...
Correct the five syntax, run-time or logic errors that are found in the CountAndAverageNumbers.java file. Link to the file: CountAndAverageNumbers.javaPreview the document. Make sure you include comments in your code where errors were corrected. If you do not flag each error with a comment, points will be deducted. Upload the corrected .java file here. The output of the corrected file looks like the following: Debug4Output.PNG This program reads an unspecified number of integers, determines how many positive and negative values...
Identify a logical error in the following code and fix it. public class test1 { public static void main(String[] args){ int total; float avg; int a, b, c; a=10; b=5; c=2; total=a+b+c; avg=total/3; System.out.println("Average: "+avg); } } Answer: Write the output of the program below. import java.util.Scanner; public class test2 { public static void main(String[] arg){ int psid; String name; Scanner input=new Scanner(System.in); System.out.println("Enter your PSID"); psid=input.nextInt(); System.out.println("Enter your...
For the below code find and fix the errors then tell what the output would be. import java.utils.*; public class pin public void main(String[] args); { char s; int num; Scanner br = Scanner(System.in); System.out.print("Enter the first letter of your name :"); s = BR.next().charAt(0); num = s; System.out.println(“The value associated with your letter is” num); }
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. // DebugFive2.java // Decides if two numbers are evenly divisible import java.util.Scanner; public class DebugFive2 { public static void main(String args[]) { int num; int num2; Scanner input = new Scanner(System.in); System.out.print("Enter a number "); num = input.nextInteger() System.out.print("Enter another number ");...
Please, modify the code below to use the Switch Statements in Java instead of “if” statements to make the decisions. import java.util.Scanner; public class Area { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter code(C for circle, R for rectangle, S for square): "); char code = in.next().charAt(0); if(code == 'C') { System.out.print("Enter radius: "); double radius = in.nextDouble(); System.out.println("Area of circle is " + (Math.PI * radius * radius)); } else if(code == 'R') {...
You will write a single java program called MadLibs. java. This file will hold and allow access to the values needed to handle the details for a "MadLibs" game. This class will not contain a maino method. It will not ask the user for any input, nor will it display (via System.out.print/In()) information to the user. The job of this class is to manage information, not to interact with the user.I am providing a MadLibsDriver.java e^{*} program that you can...
Need help with the UML for this code? Thank you. import java.util.Scanner; public class Assignment1Duong1895 { public static void header() { System.out.println("\tWelcome to St. Joseph's College"); } public static void main(String[] args) { Scanner input = new Scanner(System.in); int d; header(); System.out.println("Enter number of items to process"); d = input.nextInt(); ...
I am getting an error from eclipse stating that: Exception in thread "main" java.lang.Error: Unresolved compilation problem: at EvenOdd.main(EvenOdd.java:10) I am unable to find what I can do to fix this issue. Can you please assist? My code is below: import java.util.InputMismatchException; import java.util.Scanner; public class EvenOdd { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Welcome to this Odd program!"); int userInput1 = input.nextInt(); } public...
I am working on this switch statement code and I am getting errors. Please help. import java.util.Scanner; public class Switchstatement { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here } class Convertor { public static void main(String[] args) { int choice; Double Yen, UsDollars, Kilometer, Miles, Kilograms, Pounds, Inches; Double Centimeters, result; Scanner scanner = new Scanner(System.in); System.out.print("Enter 1\t UsDollars to Yen:...
DEBUGGING. JAVA. Identify the errors in the following. There are no logical errors in this one just syntax issues. //start import java.util.Scanner; public class NumbersDemo { public static void main (String args[]) { Scanner kb = new Scanner(System.in); int num1, num2; System.out.print("Enter an integer >> "); num1 = kb.nextInt(); System.out.print("Enter another integer >> "); num2 = kb.nextDouble(); displayTwiceTheNumber(num1); displayNumberPlusFive(num1); displayNumberSquared(num1) displayTwiceTheNumber(num2); displayNumberPlusFive(num2); displayNumberSquared(num2); } ...