Posts

Showing posts from January 7, 2019

Splitting a String and Returning Converted Data

Image
1 I have 2 Classes, the first one is only used as Container, and the second Class Splits a GpsString, Converts it to suitable data types and returns the Container Class. The String to analyze looks about like this: ("$GPGGA,120003.533,7926.184,N,02222.419,W,1,12,1.0,88.5,M,0.0,M,,*71") Now i want to know if this is good practice in ObjectOriented Programming, or if there is a better way for this Problem. final class GpsData { int Hours; int Minutes; double Seconds; double Lattitude; char DirectionLattitude; // North or South double Longitude; char DirectionLongitude; // North or South int Quality; int Satelites; } class ProtocolAnalyzer { private GpsData AnalyzedData = new GpsData(); boolean AnalyzeData(String GpsData){ GpsData Gps =