This commit is contained in:
k0rrluna 2024-10-08 13:46:16 +03:00
parent 232e2bf47f
commit b09c332067
7 changed files with 92 additions and 0 deletions

12
labs/lab1/CSYes.java Normal file
View File

@ -0,0 +1,12 @@
// *******************************************************************
// File Name: CSYes.java
//
// Purpose: Print Computer Science, Yes (underline =)
// *******************************************************************
public class CSYes
{
public static void main(String[] args) {
System.out.println("Computer Science, Yes!!!!");
System.out.println("=========================");
}
}

21
labs/lab1/Count.java Normal file
View File

@ -0,0 +1,21 @@
// *******************************************************************
// File Name: Count.java
//
// Purpose: count to 5 3 different languages
// Error type: illegal start of expression
// *******************************************************************
public class Count
{
public static void main (String[] args)
{
//prints in english
System.out.println ("one two three four five");
//prints in french
System.out.println ("un deux trois quatre cinq");
//prints in spanish
System.out.println ("uno dos tres cuatro cinco");
}
// Comment in a // comment line.
}

24
labs/lab1/Hello.java Normal file
View File

@ -0,0 +1,24 @@
// ********************************************
// Hello.java
//
// Print a Hello, World message.
// ********************************************
public class Hello
{
// -----------------------------------
// main method -- prints the greeting
// -----------------------------------
public static void main (String[] args)
{
System.out.println ("Hello, World!");
}
}
/* Errors:
1- Hello.java:6: error: class Helloo is public, should be declared in a file named Helloo.java
2- Print string changed. There's no reason for errors
3-Hello.java:13: error: unclosed string literal
4-Hello.java:13: error: ')' expected
System.out.println (Hello, World!")
5-Hello.java:13: error: ';' expected
*/

BIN
labs/lab1/Problems.class Normal file

Binary file not shown.

17
labs/lab1/Problems.java Normal file
View File

@ -0,0 +1,17 @@
// ********************************************
// Problems.java
//
// Provide lots of syntax errors for the user to correct.
//
// ********************************************
public class Problems
{
public static void main(String[] args)
{
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println("This program used to have lots of problems,");
System.out.println("but if it prints this, you fixed them all.");
System.out.println(" *** Hurray! *** ");
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
}

13
labs/lab1/Simple.java Normal file
View File

@ -0,0 +1,13 @@
// ********************************************
// Simple.java
//
// Print a simple message about Java.
//
// ********************************************
public class Simple
{
public static void main (String[] args)
{
System.out.println ("Java rocks!!");
}
}

5
labs/lab1/poem.java Normal file
View File

@ -0,0 +1,5 @@
public class java {
public static void main (String[] args) {
System.out.println("Roses are red\nViolets are blue\nSugar is sweet\nAnd so are you! ");
}
}