Advertisement
towfiqi

FitnessClass.js

Dec 25th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.77 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 fitness.bookingapp;
  7.  
  8. import java.text.DateFormat;
  9. import java.util.Date;
  10.  
  11. /**
  12.  *
  13.  * @author Towfiqul Islam
  14.  */
  15. public class FitnessClass {
  16.     private String className;
  17.     private DateFormat time;
  18.     private int count;
  19.     private int cost;
  20.     private Rating rating;
  21.    
  22.     public FitnessClass(String name, int cost, DateFormat time ) {
  23.         this.setName(name);
  24.                 this.setCost(cost);
  25.                 this.setTime(time);
  26.         rating=new Rating();
  27.                 this.addStudent();
  28.     }
  29.    
  30.     public FitnessClass(){
  31.         this.className = "Unknown";
  32.         this.rating = new Rating();
  33.                 this.count = 0;
  34.  
  35.     }
  36.        
  37.    
  38.     public String getName()
  39.     {
  40.         return this.className;
  41.     }
  42.    
  43.     public void setName(String name)
  44.     {
  45.         this.className = name;
  46.     }
  47.                
  48.         public void setTime(DateFormat time) {
  49.                 this.time = time;
  50.     }
  51.        
  52.         public DateFormat getTime() {
  53.         return time;
  54.     }
  55.        
  56.         public int getCost()
  57.     {
  58.         return this.cost;
  59.     }
  60.    
  61.     public void setCost(int classCost)
  62.     {
  63.         this.cost = classCost;
  64.     }
  65.        
  66.         public int getStudentCount()
  67.     {
  68.         return this.count;
  69.     }
  70.    
  71.     public void addStudent()
  72.     {
  73.         this.count = this.count + 1;
  74.     }
  75.        
  76.         public void removeStudent()
  77.     {
  78.         this.count = this.count - 1;
  79.     }
  80.    
  81.     public Rating getRating()
  82.     {
  83.         return this.rating;
  84.     }
  85.    
  86.     public void setRating(Rating rate)
  87.     {
  88.         this.rating = rate;
  89.     }
  90.    
  91.     public String toString()
  92.     {
  93.         return this.className+"("+this.time.format(new Date())+")"+"[$"+this.cost+"]"+" ("+this.rating+")";
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement