Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class College implements Comparable
- {
- private String name;
- private String city;
- private String state;
- private int cost;
- private int yearFounded;
- private int undergradCount;
- private double gradRate;
- public College(String n, String c, String s, int money, int y, int count, double rate)
- {
- name = n;
- city = c;
- state = s;
- cost = money;
- yearFounded = y;
- undergradCount = count;
- gradRate = rate;
- }
- public int compareTo(Object other)
- {
- College otherCollege = (College) other;
- return this.getName().compareToIgnoreCase(otherCollege.getName());
- }
- public String getName( )
- {
- return name;
- }
- public String getCity( )
- {
- return city;
- }
- public String getState( )
- {
- return state;
- }
- public int getCost( )
- {
- return cost;
- }
- public int getYearFounded( )
- {
- return yearFounded;
- }
- public int getEnroll( )
- {
- return undergradCount;
- }
- public double getGradRate( )
- {
- return gradRate;
- }
- public String toString()
- {
- return String.format("%-18s %-18s %2s %8d %8d %10d %9.1f ",
- name, city, state, cost, yearFounded, undergradCount, gradRate);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement