Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 statistics;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.ArrayList;
- import java.util.Comparator;
- import java.util.Scanner;
- /**
- *
- * @author 6272user
- */
- class Airline implements Comparable<Airline> {
- private String name;
- private int founded, aircrafts, destinations;
- public void report() { /* print result */ }
- @Override
- public int compareTo(Airline o) {
- if(this.destinations < o.destinations) return -1;
- else if(this.destinations > o.destinations) return 1;
- else return 0;
- }
- }
- ////////////////////////////////////////////////////////////////////////////////
- class SortAirlinesByCapacity implements Comparator<Airline> {
- public int compare(Airline a1, Airline a2) {
- ;
- }
- }
- ////////////////////////////////////////////////////////////////////////////////
- public class NewMain {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws FileNotFoundException {
- ArrayList<Airline> alObj = new ArrayList<Airline>();
- String infile = "airlines.txt";
- try (Scanner scanfile = new Scanner(new File(infile))) {
- while(scanfile.hasNext()) {
- }
- }
- catch(FileNotFoundException e) {
- System.err.println("An error occurs. End program.");
- System.exit(-1);
- }
- System.out.printf("Sort by [d = default, c = capacity, t = timeline, q = quit] >> ");
- Scanner scan = new Scanner(System.in);
- char choices = scan.next().charAt(0);
- switch(Character.toUpperCase(choices)) {
- case 'C':
- System.out.println("C");
- break;
- case 'D':
- System.out.println("D");
- break;
- case 'T':
- System.out.println("T");
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment