lab & assignment

This commit is contained in:
2024-10-23 15:11:20 +03:00
parent 8928b8471a
commit b1f377bfec
9 changed files with 126 additions and 3 deletions

20
labs/lab2/Errors.java Normal file
View File

@ -0,0 +1,20 @@
// File: Errors.java
// Purpose: A program with lots of syntax errors
// Correct all of the errors (STUDY the program carefully!!)
import java.util.Scanner;
public class Errors
{
public static void main (String[] args)
{
String Name; // Name of the user
int number;
int numSq;
Scanner scan = new Scanner(System.in);
System.out.println ("Enter your name, please: ");
Name = scan.nextLine();
System.out.println ("What is your favorite number?");
number = scan.nextInt();
numSq = number * number;
System.out.println (Name+", the square of your number is " + numSq);
}
}