Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.83 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package model;
  7.  
  8. /**
  9.  *
  10.  * @author mga
  11.  */
  12. public class YearData {
  13.  
  14.     /**
  15.      * @return the year
  16.      */
  17.     public String getYear() {
  18.         return year;
  19.     }
  20.  
  21.     /**
  22.      * @param year the year to set
  23.      */
  24.     public void setYear(String year) {
  25.         this.year = year;
  26.     }
  27.  
  28.     /**
  29.      * @return the precipitation
  30.      */
  31.     public float getPrecipitation() {
  32.         return precipitation;
  33.     }
  34.  
  35.     /**
  36.      * @param precipitation the precipitation to set
  37.      */
  38.     public void setPrecipitation(float precipitation) {
  39.         this.precipitation = precipitation;
  40.     }
  41.  
  42.     /**
  43.      * @return the maxTemp
  44.      */
  45.     public int getMaxTemp() {
  46.         return maxTemp;
  47.     }
  48.  
  49.     /**
  50.      * @param maxTemp the maxTemp to set
  51.      */
  52.     public void setMaxTemp(int maxTemp) {
  53.         this.maxTemp = maxTemp;
  54.     }
  55.  
  56.     /**
  57.      * @return the minTemp
  58.      */
  59.     public int getMinTemp() {
  60.         return minTemp;
  61.     }
  62.  
  63.     /**
  64.      * @param minTemp the minTemp to set
  65.      */
  66.     public void setMinTemp(int minTemp) {
  67.         this.minTemp = minTemp;
  68.     }
  69.  
  70.     /**
  71.      * @return the windSpeed
  72.      */
  73.     public int getWindSpeed() {
  74.         return windSpeed;
  75.     }
  76.  
  77.     /**
  78.      * @param windSpeed the windSpeed to set
  79.      */
  80.     public void setWindSpeed(int windSpeed) {
  81.         this.windSpeed = windSpeed;
  82.     }
  83.  
  84.     /**
  85.      * @return the windDirection
  86.      */
  87.     public String getWindDirection() {
  88.         return windDirection;
  89.     }
  90.  
  91.     /**
  92.      * @param windDirection the windDirection to set
  93.      */
  94.     public void setWindDirection(String windDirection) {
  95.         this.windDirection = windDirection;
  96.     }
  97.  
  98.     /**
  99.      * @return the EOLN
  100.      */
  101.     public static char getEOLN() {
  102.         return EOLN;
  103.     }
  104.  
  105.     /**
  106.      * @return the QUOTE
  107.      */
  108.     public static String getQUOTE() {
  109.         return QUOTE;
  110.     }
  111.    
  112.     private String year;
  113.     private float precipitation;
  114.     private int maxTemp;
  115.     private int minTemp;
  116.     private int windSpeed;
  117.     private String windDirection;
  118.    
  119.     private static final char EOLN='\n';      
  120.     private static final String QUOTE="\"";
  121.  
  122.     public YearData() {
  123.         this.year = "TBC";
  124.         this.precipitation = 0;
  125.         this.maxTemp = 0;
  126.         this.minTemp = 0;
  127.         this.windSpeed = 0;
  128.         this.windDirection = "TBC";
  129.     }
  130.  
  131.     public YearData(String year, float precipitation, int maxTemp, int minTemp, int windSpeed, String windDirection) {
  132.         this.year = year;
  133.         this.precipitation = precipitation;
  134.         this.maxTemp = maxTemp;
  135.         this.minTemp = minTemp;
  136.         this.windSpeed = windSpeed;
  137.         this.windDirection = windDirection;
  138.     }
  139.  
  140.     // Methods required: getters, setters
  141.  
  142.     @Override
  143.     public String toString() {
  144.         return "YearData{" + "year=" + getYear() + ", precipitation=" + getPrecipitation() + ", maxTemp=" + getMaxTemp() + ", minTemp=" + getMinTemp() + ", windSpeed=" + getWindSpeed() + ", windDirection=" + getWindDirection() + '}';
  145.     }
  146.      public String toString(char delimiter) {
  147.          
  148.          
  149.         String output=
  150.                 this.year+delimiter+QUOTE+
  151.                 this.precipitation+delimiter+QUOTE+
  152.                 this.maxTemp+delimiter+QUOTE+
  153.                 this.minTemp+delimiter+QUOTE+
  154.                 this.windSpeed+delimiter+QUOTE+
  155.                 this.windDirection+delimiter;
  156.            
  157.          
  158.      
  159.          
  160.                 output+=EOLN;
  161.                   System.out.println("output is"+output);
  162.                
  163.         return output;
  164.                  
  165.      
  166.      
  167. }
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement