[go: up one dir, main page]

0% found this document useful (0 votes)
5 views10 pages

Lab - Exp - 1 (Compiling and Running A Java Program) - Valera-1

This document outlines a laboratory exercise for an Object-Oriented Programming course, focusing on compiling and running Java programs using the NetBeans IDE. It includes instructions for setting up a project, creating a Java source file, adding code, and running the application, along with two activities for students to complete. The intended learning outcomes emphasize understanding the IDE and basic Java programming concepts.

Uploaded by

Cedrick Valera
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)
5 views10 pages

Lab - Exp - 1 (Compiling and Running A Java Program) - Valera-1

This document outlines a laboratory exercise for an Object-Oriented Programming course, focusing on compiling and running Java programs using the NetBeans IDE. It includes instructions for setting up a project, creating a Java source file, adding code, and running the application, along with two activities for students to complete. The intended learning outcomes emphasize understanding the IDE and basic Java programming concepts.

Uploaded by

Cedrick Valera
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/ 10

COLLEGE OF COMPUTER STUDIES AND MULTIMEDIA ARTS

CCS0023L
(OBJECT-ORIENTED PROGRAMMING)

EXERCISE

1
Compiling and Running Java Program

Student Name / Group


Name: Cedrick Nicolas C. Valera
Name Role
Members (if Group):

BSITWMA-TW21
Section:
Jay-ar Lalata
Professor:
I. PROGRAM OUTCOME/S (PO) ADDRESSED BY THE LABORATORY EXERCISE
• Analyzeacomplexproblemandidentifyanddefinethecomputingrequirementsappropriatetoitssolution.
[PO: B]

II. COURSE LEARNING OUTCOME/S (CLO) ADDRESSED BY THE LABORATORY EXERCISE


• Compare and contrast procedural/functional approach to object-oriented programming approach.
[CLO: 1]

III. INTENDED LEARNING OUTCOME/S (ILO) OF THE LABORATORY EXERCISE


At the end of this exercise, students must be able to:
• Understand how to navigate through the Netbeans IDE.
• Create, compile and run a Java program

IV. BACKGROUND INFORMATION

NetBeans IDE is a popular open-source integrated development environment (IDE) primarily used for
Java development but also supports other languages like PHP, C++, and HTML5. It offers a comprehensive
set of tools to streamline the software development process, making it a favorite among developers for both
personal and enterprise-level projects.

Setting Up the Project

1. In the IDE, choose File > New Project or click the "New Project" button in the toolbar.

2. In the New Project wizard, select Java Application, as shown in the figure below. Then click Next.

3. In the Name and Location page of the wizard, type HelloWorldApp in the Project Name field, (as
shown in the figure below):
4. Click Finish. The project is created and opened.

Creating a Java Source File

1. Right-click the package name and choose New | Java Class, (as shown in the figure below):

2. In the New Java Class wizard, type Main in the Class Name field, (as shown in the figure below):
3. Click Finish. The Java source file is created and opened.

You should see the following components, (as shown in the figure below):

• Projects window: Top left, contains a tree view of the components of the project, including
source files, libraries that your code depends on, and so on.

• Source Editor: Central area, contains files, where most of your work will be done, currently with
a Java source file called Main open.

• Navigator: Lower left, useful for quickly navigating between elements within the selected class.
Adding Code to the Java Source File

A skeleton main class has been created for you. Let’s add some basic content to produce a 'hello world'
message.

1. Between the braces, type psvm and press Tab. You should now see public static void main
statement.

2. Within the public static void main statement, type sout and press Tab. You should now see a
System.out.println statement.

3. Within the quotation marks, type hello world.

You should now see the following:

Running the Application

1. Make sure to save the Java source file, right-click the project and choose Run or choose Run
Project under the Run menu. Click Select Main Class.

2. In the Output window (which can be opened from the Window menu), you should see the below.
V. LABORATORY ACTIVITY

ACTIVITY 1.1: Oh My COR

Write a Java program to recreate your Certificate of Registration (COR) using System.out.println().

Program: (Project Name: COR )

Copy and paste your complete working program here.

/*

• Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license

*/

package my.java.cor;

/** *

• @author ccvalera

*/ public class COR {

public static void main(String[] args) {


System.out.println("Enrollment Status: ENROLLED
College : COMPUTER STUDIES Program : BSITWMA");
System.out.println("Student#: 202410110
Year Level : 2 1st term, SY 25-26");
System.out.println("Name: VALERA, CEDRICK NICOLAS CUGAS
Address : B 80 L 64 Florante at Laura St., Lagro, Quezon City");
System.out.println("Phone: 89302212 Zip Code : 1100");
System.out.println("Classification: \n");

System.out.println("Courses Title
Section Units Days Time Room");

System.out.print("CCS0023 ");
System.out.print("OBJECT ORIENTED PROGRAMMING (LEC) ");
System.out.println("TW21 2 F 16:00-18:40
ONLINE");

System.out.print("CCS0023L ");
System.out.print("OBJECT ORIENTED PROGRAMMING (LAB) ");
System.out.println("TW21 1 W 16:00-18:50
F1211");

System.out.print("GED0019 ");
System.out.print("UNDERSTANDING THE SELF ");
System.out.println("TW21 3 F/T 13:00-14:50
ONLINE/ONLINE");

System.out.print("GED0021 ");
System.out.print("SPECIALIZED ENGLISH PROGRAM 2 ");
System.out.println("TW21 3 M/TH 07:00-08:50
E711/E711");

System.out.print("IT0017 ");
System.out.print("DISCRETE MATHEMATICS ");
System.out.println("TW21 3 M/TH 11:00-12:50
E711/E711");

System.out.print("IT0019 ");
System.out.print("QUANTITATIVE METHODS (INCL MODELING...) ");
System.out.println("TW21 3 F/T 11:00-12:50
ONLINE/ONLINE");

System.out.print("IT0051 ");
System.out.print("HUMAN COMPUTER INTERACTION 2 ");
System.out.println("TW21 3 T/W 16:00-
17:50/13:00-14:50 ONLINE/E407");

System.out.print("IT0119 ");
System.out.print("INFORMATION MANAGEMENT ");
System.out.println("TW21 2 T 07:00-09:40
ONLINE");

System.out.print("IT0119L ");
System.out.print("INFORMATION MANAGEMENT (LAB) ");
System.out.println("TW21 1 F 07:00-09:50
ONLINE");

System.out.println("TOTAL UNITS: 21");


}

Output:(screenshot of the output)

Note: When you take the screenshot include the whole output window
ACTIVITY 1.2 My Info

Declare the following variables below inside the main() and create a Java program to produce the
output below.

/*Here, we Declare different data types*/


int age = 20, year = 2023;
char gender = '<put your gender here>';
String course = "Object-Oriented Programming"
String name = “<put your first name and last name here>”;
double height = <put your height here in inches>;
float weight = <put your weight here in lbs>;
boolean bool = true;

Expected Output:

Program: (Project Name: MyInfo )

Copy and paste your complete working program here.

/*

• Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license

*/

package my.java.act1point2;

/** *

• @author ccvalera

*/ public class Act1point2 { public static void main(String[] args) { int age = 20, year = 2023; char gender =
'M'; String course = "Object-Oriented Programming"; String name = "Jay-ar Lalata"; double height = 175.26;
float weight = 209.43f; boolean bool = true;

System.out.println("Hi I am " + name + ". I am " + age + " years


old. And I am " + gender);
System.out.println("This year " + year + ". I am studying the
course " + course);
System.out.println("My height is " + height + " inches and my
weight is " + weight);
System.out.println("What I believe is that I will pass OOP and
that is " + bool);
}

Output:(screenshot of the output)

Note: When you take the screenshot include the whole output window

You might also like