Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

39 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Week 1 OOP Lab Assignment

Student Information

  • Name: Wania Batool
  • Seat No: B25110006171
  • Section: A
  • Course: Object Oriented Programming (OOP)
  • Department: Computer Science
  • University: University of Karachi

About this Repository

This repository contains my Week 1 OOP lab assignment.

The purpose of this lab was to understand the basic concepts of Object-Oriented Programming by creating classes, objects, attributes, methods, constructors, and UML diagrams.

The assignment contains two Java programs:

  • Car Demo
  • Calculator Demo

Folder Structure

Week01
│
├── CarDemo
│   ├── Car.java
│   ├── Main.java
│   ├── Car_UML.png
│   └── SampleOutput.txt
│
└── CalculatorDemo
    ├── Calculator.java
    ├── Main.java
    ├── Calculator_UML.png
    └── SampleOutput.txt

Task 1 - Car Demo

In this task, I created a Car class and added different attributes and methods to represent a real car.

Attributes

  • Brand
  • Color
  • Speed
  • Engine Status
  • Fuel Level
  • Gear
  • Headlights Status
  • Music Status

Methods

  • Start Engine
  • Stop Engine
  • Drive
  • Move Fast
  • Move Slow
  • Move Left
  • Move Right
  • Turn On Headlights
  • Play Music
  • Turbo Mode
  • Display State

The Main.java file creates two different car objects to show that each object has its own state.


Task 2 - Calculator Demo

In this task, I created a Calculator class that performs different mathematical operations.

Operations

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulus
  • Power
  • Average
  • Maximum

The calculator also handles division by zero by displaying an error message.


UML Diagrams

UML class diagrams for both the Car and Calculator classes are included in this repository.


Sample Output

Sample output files are included for both programs.


What I Learned

After completing this lab, I learned about:

  • Classes and Objects
  • Attributes
  • Methods
  • Constructors
  • Creating multiple objects
  • Object state
  • UML Class Diagrams
  • Basic Java programming

Software Used

  • Java
  • Visual Studio Code
  • Git
  • GitHub
  • Draw.io

Author

Wania Batool

BS Computer Science

University of Karachi

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages