Unit Conversion System:
Class Design &
Implementation
This presentation outlines the design and implementation of a unit
conversion system. We'll explore key object-oriented concepts. The
system allows users to convert between different units.
by Yves Girukwishaka
and Raphael Karani
Project Overview and System Requirements
Project Goal System Requirements
Develop a flexible unit conversion tool. The tool should The system should support length, weight and volume units.
handle various unit types. It will provide accurate conversions.
Key Object-Oriented Concepts and
Assumptions
Classes Inheritance Polymorphism
1 2 3
Classes are fundamental building Units will inherit from a base Different units will exhibit
blocks. Units will be represented class. This ensures a consistent polymorphic behavior. Each
as classes. interface. conversion is handled uniquely.
Class Structure:
Attributes, Methods, and
Inheritance
Attributes Methods Inheritance
Each unit class will Conversion methods Inheritance ensures
have attributes. will be implemented. consistency and
Examples include These methods reduces redundancy.
value and unit type. perform the This is achieved
calculations. through a base class.
Program Architecture and
Control Flow
User Input
The user provides the input value and units.
Conversion
The system identifies and performs the conversion.
Output
The converted value is displayed to the user.
Detailed Design: Pseudo
Code Implementation
// Input: value, fromUnit, toUnit
// Create Unit objects from fromUnit and toUnit
// result = fromUnit.convertTo(toUnit, value)
// Output: result
This pseudocode outlines the basic conversion process. It involves
creating unit objects. The code then calls the convertTo method.
C# Code Implementation and
Testing
public class Unit {
public double convertTo(Unit target, double value) {
// Conversion logic here }
This shows the C# implementation. A Unit class handles conversions. The convertTo method performs the calculation. Testing
ensures accuracy.
Future Improvements
and Lessons Learned
Expand Unit Types Error Handling
Add support for more unit Improve error handling.
types. Include currency and Provide user-friendly
data storage. messages.
GUI
Develop a graphical user interface. This will enhance the user
experience.