0% found this document useful (0 votes)
64 views62 pages

Lab1 Handout

This document provides information about Lab 1 for a computer programming course in Java. It introduces the lab instructor, Mustafa Ersen, and student assistant Irem Eker. It describes the general structure of lab sessions, which will include a topic summary, group exercises done together, and an individual graded exercise submitted by students. This week's topics are introduced, including writing a simple "Hello World" Java program, using online and local development environments, and submitting work to the Blackboard learning management system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views62 pages

Lab1 Handout

This document provides information about Lab 1 for a computer programming course in Java. It introduces the lab instructor, Mustafa Ersen, and student assistant Irem Eker. It describes the general structure of lab sessions, which will include a topic summary, group exercises done together, and an individual graded exercise submitted by students. This week's topics are introduced, including writing a simple "Hello World" Java program, using online and local development environments, and submitting work to the Blackboard learning management system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Lab 1

COMP109 – Computer Programming (Java)


Mustafa Ersen
[email protected]
About the Lab Instructor

 Teaching Assistant Mustafa Ersen, MEF Computer Eng. Dept.

 E-mail: [email protected]

 Send me an e-mail whenever you have any question!

 Student Assistant: İrem Eker


General Overview of Lab Sessions

 In each lab session of this course we will have a similar content as follows:
 A brief summary of the topics covered in the session
 1-2 Group Exercise(s):
 We will go over the group exercise(s) together.
 You can use the group exercise(s) as a guide while solving the individual exercise(s).
 1 Individual (Graded) Exercise:
 You will solve the individual exercise on your own (no code sharing with other students!) and submit your
solution (a Java code file and a video in which you explain your solution) using Blackboard.
 The video must contain the Java code, your voice explaining the code and your camera view while you are
explaining the code.
 You can ask for help whenever needed during the lab sessions.
 Grading will be done on a scale of 0: Incorrect/NA, 1: Partially correct and 2: Correct.
 Important: Only the students who attend a lab session (via Zoom Meeting in Blackboard) can get a
grade for that session by solving and submitting the individual exercise given in that session.
 You can attend any lab session for this course without a restriction.
This Week
 Introductory Contents:
 Your first Java program: Hello World
 A suitable development environment for creating and running Java programs
1. Using an online Java programming environment: JDoodle IDE
2. Installing a Java programming environment in your own computer/laptop: Eclipse IDE
 Using Zoom to record a video that contains a Java code, your voice explaining the code and your
camera view while you are explaining the code
 Successfully submitting your Java code and video files to Blackboard
 Lab 1 Contents:
 Topic(s) Covered This Week
 2 Group Exercises
 1 Individual Exercise
 You need to submit your solution (a .java code file and a video) for the individual exercise
under LAB1 in Blackboard.
Your First Java Program: Hello World
A Simple Java Program: Displaying Hello World
 Each Java program must have at least one class.
 Each Java program must have exactly one class containing the main method.
 The main method is the entry point where the program starts execution. Thus, a Java program without a
main method cannot run.

/* A Java program that displays Hello World


on the console */
public class HelloWorld {
public static void main(String[] args) {
// print Hello World on the console
System.out.println("Hello World");
}
}
A Simple Java Program: Displaying Hello World
 Each Java program must have at least one class.
 Each Java program must have exactly one class containing the main method.
 The main method is the entry point where the program starts execution. Thus, a Java program without a
main method cannot run. name of the class

/* A Java program that displays Hello World


on the console */
public class HelloWorld {
public static void main(String[] args) {
// print Hello World on the console
System.out.println("Hello World");
}
}

Code is written in a text file: HelloWorld.java (A public


class must be written in a file named same as the class)
A Simple Java Program: Displaying Hello World
 Each Java program must have at least one class.
 Each Java program must have exactly one class containing the main method.
 The main method is the entry point where the program starts execution. Thus, a Java program without a
main method cannot run.

/* A Java program that displays Hello World


on the console */
public class HelloWorld {
public static void main(String[] args) {
main method inside // print Hello World on the console
the class block { } System.out.println("Hello World");
}
}
A Simple Java Program: Displaying Hello World
 Each Java program must have at least one class.
 Each Java program must have exactly one class containing the main method.
 The main method is the entry point where the program starts execution. Thus, a Java program without a
main method cannot run.

/* A Java program that displays Hello World


on the console */
public class HelloWorld {
public static void main(String[] args) {
// print Hello World on the console
System.out.println("Hello World");
}
}

a single line comment (starts with //)


and a statement/command (ends with ;)
inside the main method block { }
A Simple Java Program: Displaying Hello World
 Each Java program must have at least one class.
 Each Java program must have exactly one class containing the main method.
 The main method is the entry point where the program starts execution. Thus, a Java program without a
main method cannot run.
a block (multiline) comment
(between /* and */)
/* A Java program that displays Hello World
on the console */
public class HelloWorld {
public static void main(String[] args) {
// print Hello World on the console
System.out.println("Hello World");
}
}
Creating, Compiling and Running a Java Program
 Programming in Java is simply a three step process:
 Coding: Creating the source code of a Java program using any text editor and saving it as a .java file.
 Compiling: Java source code is compiled using the Java compiler into a .class file known as the bytecode.
 Running: The bytecode can then run on any device with a Java Virtual Machine (JVM) which is a software that interprets
and runs Java bytecode.
 These 3 steps are integrated in JDoodle and Eclipse IDEs.
public class HelloWorld {
public static void main(String[] args) { Output:
System.out.println("Hello World");
} Hello World is displayed on the console.
}
compiling
source code Source Code: HelloWorld.java
(javac
command) ...
interpreting
public static void main(java.lang.String[]);
... bytecode
stack=2, locals=1, args_size=1 (java command)
0: getstatic #7
3: ldc #13
5: invokevirtual #15
8: return
...
Bytecode: HelloWorld.class

Library Code
A Suitable Development Environment for Creating and
Running Java Programs
Using an Online Java Programming Environment
JDoodle Online Java IDE
 You can use JDoodle for this lab as it has
sufficient capabilities and it is easy to use
without installing anything on your PC.
 https://www.jdoodle.com/online-java-compiler/
Writing and Running the Hello World Program in JDoodle

Editor for writing


the Java code of
your program

Press this button for


running your program

The console that displays the


output of your Java program as
the program is being executed
Installing a Java Programming Environment in Your Own
Computer/Laptop
Downloading Eclipse IDE for Java Developers
 Click here to open the download page in your browser,
➀ select the installer compatible with the Operating System you are using
➁ and download the installer by clicking Download in the page that will open.

 Note: You do not need to download and install the Java Runtime Environment (JRE) as it is
included in the Eclipse Installer 2021-09 R.
Installing Eclipse IDE for Java Developers
 Open the installer that you have downloaded.
 After opening the installer, select “Eclipse IDE
for Java Developers” to install. Select
Installing Eclipse IDE for Java Developers
 Proceed with the installation by clicking
INSTALL and follow the incoming steps in
the installer.

Click to
install
Installing Eclipse IDE for Java Developers
 You will see the window on the right once
the installation is complete.
 You can open Eclipse by clicking the
LAUNCH button.

Click to open
Eclipse IDE
Selecting a Folder to be used as Eclipse Workspace
 After opening Eclipse you will see the window below.
 Select the folder for workspace (where your programs will be stored) by using the Browse
button and then open Eclipse by clicking on the Launch button.
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
 Creating a Hello World Application in Eclipse:
Introduction ?
 Open Eclipse. This cheat sheet shows you how to create the famous "Hello World" application and try it
 Select Help􀄫Welcome from the main menu on the top. out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
 This will open the Welcome to the Eclipse IDE for Java Click to Begin
Developers window. Open the Java perspective ?
 From the opened window, select Create a Hello World If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
application.
Create a Java project ?
 This will open the Create a Hello World application cheat Before creating a class, we need a project to put it in. In the main toolbar, click on the
sheet which is reprinted on the right for convenience. New Java Project button. Enter HelloWorld for the project name, then click Finish.

 Follow the steps in this cheat sheet as shown in the next slides to Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
create and run the Hello World application in Eclipse. Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
Introduction ?
Clicking on the New Java Project button This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!

 Click to Begin
Open the Java perspective ?

 If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
Introduction ?
This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
Important: Make sure that this option is not selected. ?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
 After creating the project, you should see it in the
Introduction ?
Package Explorer as shown below. This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
Introduction ?
Clicking on the New Java Class button This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
Introduction ?
This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
No need to use packages for small programs, so leave empty. Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
Note: The class name does not have to be the same as the "Hello world!" output.
project name as in this example. Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
 After creating the class, you can see it under the
Introduction ?
HelloWorld project in the Package Explorer as This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
shown below. console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
The basis for a Java program: one class containing the main method
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
Introduction ?
This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
Introduction ?
This cheat sheet shows you how to create the famous "Hello World" application and try it
Important: This asterisk symbol shows that the changes made on the java
out. You will create a Java project and a Java class that will print "Hello world!" in the
file are not saved. console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
The asterisk symbol disappears after clicking on the save button. ?
Introduction
This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
Introduction ?
This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
 right-click on the class (java file) Before creating a class, we need a project to put it in. In the main toolbar, click on the
in the Package Explorer New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
  Congratulations! You have successfully created a Hello World application!
Creating a Hello World Application in Eclipse IDE for Java Developers
Create a Hello World application
Introduction ?
This cheat sheet shows you how to create the famous "Hello World" application and try it
out. You will create a Java project and a Java class that will print "Hello world!" in the
console when run. If you need help at any step, click the (?) to the right. Let's get started!
Click to Begin
Open the Java perspective ?
If you're not already in the Java perspective, in the main menu select Window > Open
Perspective > Java.
Create a Java project ?
Before creating a class, we need a project to put it in. In the main toolbar, click on the
New Java Project button. Enter HelloWorld for the project name, then click Finish.
Create your HelloWorld class ?
The next step is to create a new class. In the main toolbar again, click on the New Java
Class button. If not already specified, select HelloWorld/src as the source folder. Enter
HelloWorld for the class name, select the checkbox to create the main() method, then
click Finish. The Java editor will automatically open showing your new class.
Add a print statement ?
Now that you have your HelloWorld class, in the main() method, add the following
statement:
System.out.println("Hello world!");
Then save your changes; the class will automatically compile upon saving.
?
Run your Java application
To run your application, right-click on your class in the Package Explorer and select Run
As > Java Application. The Console view should appear at the bottom and display the
"Hello world!" output.
Congratulations! You have successfully created a Hello World application!
Using Zoom to Record a Video Assignment
Using Zoom to Record a Video Assignment
 Open the Zoom App and then you should see a window similar to the one shown below.
Using Zoom to Record a Video Assignment
 Press the Settings button to open the Settings window.
Using Zoom to Record a Video Assignment
 Perform the recording settings.
Set the directory in which your video will be recorded.

This option must be selected.


Using Zoom to Record a Video Assignment
 Close the Settings window and then select New Meeting.
Using Zoom to Record a Video Assignment
 Press the Join with Computer Audio button.
Using Zoom to Record a Video Assignment
 A window will open. The bottom panel of the window should look like the one shown below.

 Make sure that your  Then press the Share


microphone and camera Screen button.
are open as shown below.
Using Zoom to Record a Video Assignment
 Select the application window you want to share (Any text/code editor showing your Java
code file is good. Here I am using Notepad++.). Then press the Share button.


Using Zoom to Record a Video Assignment
 A window similar to the one below will open. You can adjust the screen where your camera
view is displayed by dragging it using the mouse.
Using Zoom to Record a Video Assignment
 A top panel will open when you hover your mouse over the icons at the top.
Using Zoom to Record a Video Assignment
 Press the More button then press Record on this Computer from the options that open.
 This starts the recording. You can now explain your code.
Using Zoom to Record a Video Assignment
 Press the End button as shown below after your recording is complete. Then press the End
Meeting for All button in the window that opens.


Using Zoom to Record a Video Assignment
 You will see the window below while the recorded video is being prepared.

 Then you can find the video in a directory in the


location that you have set for local recordings.
Successfully Submitting Your Files to Blackboard
Names of Java Files to be Submitted
 Each Java code file you submit must be named using the same name with the class it
contains.
Preparing Your Code Files for Submission (Using JDoodle IDE)
 The program (code) files you submit must have the type Java having .java extension.
 Do not submit compressed files (zip, rar etc.). Submit each program in a separate .java file.
 How to copy your Java code file from JDoodle Online IDE:

A panel will pop


up on the right


Click Save (to local file)
 Click … button to download the code
file as ClassName.java
(here HelloWorld.java)
Preparing Your Code Files for Submission (Using Eclipse IDE)
 The program (code) files you submit must have the type Java having .java extension.
 Do not submit compressed files (zip, rar etc.). Submit each program in a separate .java file.
 How to copy your Java code file(s) from Eclipse IDE:

2-Right click on an empty area on 3-Your code file is ready for


1-After saving your code(s) in Eclipse IDE, right click on the code your desktop and select Paste submission to Blackboard.
file(s) in Package Explorer and select Copy from the list that opens. from the list that opens.
Note: You can use CTRL (Windows) / CMD (Mac OS X) to select
multiple code files if needed.
Successfully Submitting Your Code and Video Files in Blackboard
 Select the course in
Blackboard.
 Open Course Content.
 Open the LAB WORKS
folder.
 Open the lab assignment
(e.g., LAB1 for the 1st lab).
Successfully Submitting Your Code File (.java File) in Blackboard

1-Select the code file to be


submitted using the mouse.

2-Drag and drop the code


file to the Attach Files area.
Successfully Submitting Your Video File (.mp4 File) in Blackboard

1-Select the video file to be


submitted using the mouse.

2-Drag and drop the video


file to the Attach Files area.
Successfully Submitting Your Code and Video Files in Blackboard

1-Check the names and


the types of the attached
files for any problems. 2-Then click the Submit button.
Successfully Submitting Your Code and Video Files in Blackboard
1. You should see a page like the one below showing that your submission is successful.
2. You should review the contents of the files you have submitted by clicking on the files on the right
panel and make a resubmission in case of any problems.
1

The contents of the


2
clicked file on the right
panel can be seen here.
Lab 1 Contents
Topics Covered This Week
Console Output: The table on the right Method Description
summarizes the basic Java methods
System.out.print(String s); prints s on the console
used for displaying text on the console.
 Example: The code fragment and its System.out.println(String s); prints s on the console followed by a newline
output given on the right exemplifies (moves to the beginning of the next line after displaying s)
usage of print and println statements. System.out.println(); prints an empty line on the console
 Note: Anything inside double quotes (")
is printed on the console as it is. Thus,
evaluated expressions such as math
operations and variables are not // print method: no newline after printing
enclosed in quotes. System.out.print("Welcome to Computer Programming");
// println method: move to the next line after printing
System.out.println(" and Java");
Arithmetic Operators: System.out.println(); // creates an empty line
// print a string(within " ") and a numerical evaluation(without " ") using +
Operator Example Result
System.out.println("Length of sentence above is " + (31 + 9));
addition + 15 + 17 32
Console Output: Caution: 319 is printed on the console
subtraction - 15.0 - 1.7 13.3 instead of 40 (31+9 where + is used for
Welcome to Computer Programming and Java
multiplication * 1.25 * 20 25.0 concatenation) when parentheses are not
Length of sentence above is 40 used for (31 + 9)
division / 5/2 2
remainder % 5%2 1
Group Exercises
Group Exercise 1
 Write a program that displays the following three messages.
 Welcome to Java,
 Welcome to Computer Science,
 and Programming is fun.
 Solution:
/* A program that displays three messages: Welcome to Java,
Welcome to Computer Science, and Programming is fun.
*/
public class GroupExercise_01_01 {
public static void main(String[] args) {
// using println to display messages in three separate lines
System.out.println("Welcome to Java");
System.out.println("Welcome to Computer Science");
System.out.println("Programming is fun");
}
}
Console Output
Welcome to Java
Welcome to Computer Science
Programming is fun
Group Exercise 2
 Write a program that displays a simple math problem with is solution as follows.
9.5 X 4.5 - 2.5 X 3
The part that does not require
------------------- evaluation and thus printed as it is using
45.5 - 3.5 double quotes (" ")
= The part that requires evaluation (result
0.8392857142857143 of a mathematical expression) and thus
printed without using double quotes (" ")
 Solution:
// A program that displays a simple math problem with its solution. Console Output
public class GroupExercise_01_02 { 9.5 X 4.5 - 2.5 X 3
public static void main(String[] args) { -------------------
System.out.println("9.5 X 4.5 - 2.5 X 3"); 45.5 - 3.5
System.out.println("-------------------"); =
System.out.println(" 45.5 - 3.5"); 0.8392857142857143
System.out.println(" =");
System.out.println((9.5 * 4.5 - 2.5 * 3) / (45.5 - 3.5));
}
}

Empty spaces are


put inside double
quotes (" ")
Individual Exercise
Individual Exercise
Display a pattern:
 Write a program that prints the following pattern.
J A V V A
J A A V V A A
J J AAAAA V V AAAAA
J J A A V A A

DO NOT FORGET TO UPLOAD YOUR SOLUTION AND VIDEO TO BLACKBOARD

You might also like