SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 314 Weeks Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 20 Dec 2017 My Price 10.00

Ph1 and earthquakescsv are hw requirements.

can you help me with my java programing hw. Ph1 and earthquakescsv are hw requirements. the rest of 4 java files are my own program, I need your help to fix and complete them. Thank you!

  • /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package earthquake;

    /**
     *
     * @author xuqidi
     */
    public class NonClassified extends Earthquake
    {
       
        public NonClassified (String d, double lat, double lon, double m, String i, int p)
        {
            super (d, lat, lon, m, i, p);
        }
    }/*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package earthquake;

    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.PrintWriter;
    import java.util.Scanner;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.InputMismatchException;
    /**
     *
     * @author xuqidi
     */
    public class EarthquakeTester
    {
        public static void main (String[] args0) throws FileNotFoundException
        {
            // Construct Scanner objects for input files
            Scanner in = new Scanner(new File("earthquakescsv.txt"));
            Scanner in1;
           
            // Construct PrintWriter for the output file
            PrintWriter out1 = new PrintWriter("invalidInput.txt");
            PrintWriter out2 = new PrintWriter("sortedEarthquakes.txt");
           
            String dateTimeZ;
            double latitude;
            double longitude;
            double magnitude;
           
            while (in.hasNextLine())
            {
                in1 = new Scanner (in.nextLine());
                try
                {
                    dateTimeZ = in1.next();
                    latitude = Integer.parseInt(in1.next());
                    longitude = Integer.parseInt(in1.next());
                    magnitude = Integer.parseInt(in1.next());
                   
                   
                    if (dateTimeZ.length()==24)
                    {
                        throw new IllegalArgumentException("Error, invalid date time zone");
                    }
                   
                    else if (latitude < -90 && latitude > 90 && longitude < -90 && longitude > 90 && magnitude < -1.0 && magnitude > 1.0)
                    {
                        throw new IllegalArgumentException("Error, invalid date time zone");
                    }
                }
               
                catch (NumberFormatException ex)
                {
                    System.out.println(ex.getMessage());
                }
                catch (IllegalArgumentException ex)
                {
                    System.out.println(ex.getMessage());
                }
                catch (InputMismatchException ex)
                {
                    System.out.println("Removing " + in.next());
                }
                catch (IndexOutOfBoundsException ex)
                {
                   
                }
                   
           
            
            
             // Extract the earthquakes and associate values
            }
           
            ArrayList <Earthquake> arrayList = new ArrayList <Earthquake>();
            Collections.sort(arrayList);
            for (Earthquake e: arrayList)
            out2.print();
           


        }
    }
    public abstract class Earthquake implements Comparable
    {
        private String dateTimeZ;
        private double latitude;
        private double longitude;
        private double magnitude;
        private String id;
        private String place;

        /**
            Constructs the Earthquake with the given d, lat, lon, m, i, and p
            @param d the dateTimeZ
            @param lat the latitude
            @param lon the longitude
            @param m the magnitude
            @param i the id
            @param p the place
        */
       
        public Earthquake (String d, double lat, double lon, double m, String i, String p)
        {
            this.dateTimeZ = d;
            this.latitude = lat;
            this.longitude = lon;
            this.magnitude = m;
            this.id = i;
            this.place = p;
        }
       
        /**
            Overrides the default toString method of Object
            @return the class of the object and its instance fields
        */
       
        public String toString()
        {
            return getClass().getName() + "[" + dateTimeZ + latitude + longitude + magnitude + id + place + "]";
        }
       
        /**
            Gets the DateTimeZ of the earthquake
            @return the dateTimeZ
        */
       
        public String getDateTimeZ()
        {
            return dateTimeZ;
        }
       
        /**
            Gets the Latitude of the earthquake
            @return the latitude
        */
       
        public double getLatitude()
        {
            return latitude;
        }
       
        /**
            Gets the Longitude of the earthquake
            @return the longitude
        */
       
        public double getLongitude()
        {
            return longitude;
        }

        /**
            Gets the Magnitude of the earthquake
            @return the magnitude
        */
       
        public double getMagnitude()
        {
            return magnitude;
        }
       
        /**
            Gets the Id of the earthquake
            @return the id
        */
       
        public String getId()
        {
            return id;
        }
     
        /**
            Gets the Place of the earthquake
            @return the place
        */
       
        public String getPlace()
        {
            return place;
        }
       
        public abstract int magnitude();
       
        /**
           Compares earthquakes based on their magnitudes
           @return the difference between magnitudes
        */
       
        public int compareTo(Object otherObject)
        {
           Earthquake other = (Earthquake) otherObject;
           return this.magnitude()-other.magnitude();
        }
    }
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package earthquake;

    /**
     *
     * @author xuqidi
     */
    public class Classified extends Earthquake
    {
        private String magnitudeClass;

        public Classified(String d, double lat, double lon, double m, String i, int p)
        {
            super (d, lat, lon, i, p);
          
           
            if (m > 3 && m < 3.9)
            {
                magnitudeClass = "Minor";
            }
           
            if (m> 4 && m < 4.9)
            {
                magnitudeClass = "Light";
            }
               
        }
       
        public String toString()
        {
            return super.toString() + "[magnitude = " + magnitudeClass + "]";
           
        }
       
       
        public String getMagnitudeClass()
        {
            return magnitudeClass;
        }
    }


Attachments:

Answers

(5)
Status NEW Posted 20 Dec 2017 02:12 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)