- Name: Wania Batool
- Seat No: B25110006171
- Section: A
- Course: Object Oriented Programming (OOP)
- Department: Computer Science
- University: University of Karachi
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
Week01
│
├── CarDemo
│ ├── Car.java
│ ├── Main.java
│ ├── Car_UML.png
│ └── SampleOutput.txt
│
└── CalculatorDemo
├── Calculator.java
├── Main.java
├── Calculator_UML.png
└── SampleOutput.txt
In this task, I created a Car class and added different attributes and methods to represent a real car.
- Brand
- Color
- Speed
- Engine Status
- Fuel Level
- Gear
- Headlights Status
- Music Status
- 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.
In this task, I created a Calculator class that performs different mathematical operations.
- Addition
- Subtraction
- Multiplication
- Division
- Modulus
- Power
- Average
- Maximum
The calculator also handles division by zero by displaying an error message.
UML class diagrams for both the Car and Calculator classes are included in this repository.
Sample output files are included for both programs.
After completing this lab, I learned about:
- Classes and Objects
- Attributes
- Methods
- Constructors
- Creating multiple objects
- Object state
- UML Class Diagrams
- Basic Java programming
- Java
- Visual Studio Code
- Git
- GitHub
- Draw.io
Wania Batool
BS Computer Science
University of Karachi