diff options
author | KT <tran0563@umn.edu> | 2021-09-06 19:07:33 -0500 |
---|---|---|
committer | KT <tran0563@umn.edu> | 2021-09-06 19:07:33 -0500 |
commit | cccd3186305915d92b1751dc616979d64116a4aa (patch) | |
tree | 5dd4834daef547cd45fc0b643f44a10b581de0ad /dev/a3-earthquake/earthquake.cc | |
parent | Added missing images for the A6 worksheet (diff) | |
download | csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.gz csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.bz2 csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.lz csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.xz csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.zst csci4611-cccd3186305915d92b1751dc616979d64116a4aa.zip |
Upload a1
Diffstat (limited to 'dev/a3-earthquake/earthquake.cc')
-rw-r--r-- | dev/a3-earthquake/earthquake.cc | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/dev/a3-earthquake/earthquake.cc b/dev/a3-earthquake/earthquake.cc deleted file mode 100644 index cf4a75a..0000000 --- a/dev/a3-earthquake/earthquake.cc +++ /dev/null @@ -1,50 +0,0 @@ -/** CSci-4611 Assignment 3: Earthquake - */ - -#include <sstream> -#include "earthquake.h" - - -Earthquake::Earthquake() { -} - -Earthquake::Earthquake(std::string s) { - line = s; -} - -Date Earthquake::date() { - int year = ParseInt(line.substr(12,4)); - int month = ParseInt(line.substr(17,2)); - int day = ParseInt(line.substr(20,2)); - int hour = ParseInt(line.substr(24,2)); - int minute = ParseInt(line.substr(27,2)); - double second = ParseFloat(line.substr(30,5)); - - return Date(month, day, year, hour, minute, second); -} - -double Earthquake::longitude() { - return ParseFloat(line.substr(44,8)); -} - -double Earthquake::latitude() { - return ParseFloat(line.substr(37,7)); -} - -double Earthquake::magnitude() { - return ParseFloat(line.substr(66,4)); -} - -double Earthquake::ParseFloat(std::string s) { - std::stringstream ss(s); - double f; - ss >> f; - return f; -} - -int Earthquake::ParseInt(std::string s) { - std::stringstream ss(s); - int i; - ss >> i; - return i; -}
\ No newline at end of file |