0% found this document useful (0 votes)
49 views4 pages

9 Lab (OOP)

The document describes two exercises for a lab assignment in an IT program. The first exercise involves creating a GUI application to calculate force using Newton's second law of motion. The provided source code demonstrates how to parse user input for mass and acceleration and output the calculated force. The second exercise requires developing a login interface for a scenario like a cafeteria or cybersecurity site, with appropriate design, controls, and source code to save user input like name, age, gender, and selected courses to a text area.

Uploaded by

itshappyday777
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)
49 views4 pages

9 Lab (OOP)

The document describes two exercises for a lab assignment in an IT program. The first exercise involves creating a GUI application to calculate force using Newton's second law of motion. The provided source code demonstrates how to parse user input for mass and acceleration and output the calculated force. The second exercise requires developing a login interface for a scenario like a cafeteria or cybersecurity site, with appropriate design, controls, and source code to save user input like name, age, gender, and selected courses to a text area.

Uploaded by

itshappyday777
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/ 4

NAME: MADEEHA TALIB

ROLL NO: 02-235221-010


ASSIGNEMNT NO: LAB (9)
PROGRAM: BS (IT) (FALL 2022)
LAB SIR NAME: SIR MAJID RIAZ
EXERCISES OF LAB 9

EXERCISE 1:
Create a GUI based application system that calculates the newton’s second law of motion i.e., F=ma
where,

F=Force in Newton

m= mass in grams

a= acceleration (a=9.8m/s2 for free falling bodies )

use proper alignment and design suitable to the application being created.

SOURCE CODE:
CALCULATE FORCE:
private void CALCULATEActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int mass = Integer.parseInt(m.getText());

int accel = Integer.parseInt(a.getText());

Integer f;

if(mass > 0 && accel > 0)

f= mass * accel;

F.setText((f).toString() + " Newtons");

else

f = 0;

}
OUTPUT:

EXERCISE 2:
Create a login system interface based on your own choice of environment for example, cafeteria, cyber
security site or etc. Make sure you have your own unique scenario and apply proper designing chose
appropriate color palette and images. System must have proper labels, text boxes, buttons, and other
necessary controls.

SOURCE CODE:
ADMISSION FORM:
private void saveActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jtextarea1.append("NAME: "+name.getText()+ "\n");

jtextarea1.append("LAST NAME: "+lastname.getText()+ "\n");

jtextarea1.append("AGE: "+age.getText()+ "\n");

jtextarea1.append("SEMESTER: "+semester1.getSelectedItem().toString());

if (M.isSelected())

jtextarea1.append("\nGENDER : MALE " + "\n");

else if (FM.isSelected())
{

jtextarea1.append("\nGENDER : FEMALE " + "\n");

if(DD.isSelected())

jtextarea1.append("COURSE 1: DIGITAL DESIGN "+"\n");

if(DM.isSelected())

jtextarea1.append("COURSE 2: DISCRETE MATHS "+"\n");

if(OOP.isSelected())

jtextarea1.append("COURSE 3: OBJECT ORIENTED PROGRAMMING "+"\n");

OUTPUT:

You might also like