Guest User

Untitled

a guest
Apr 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. import java.util.*;
  2. public class Homework {
  3. //class creates the 2 data types needed
  4. class HomeworkProblem implements Comparable<HomeworkProblem>{
  5.  
  6. // The difficulty of this homework problem.
  7. public int Weight;
  8. // How long it will take to do this homework problem.
  9. public int Time;
  10. public HomeworkProblem(int Weight, int Time){
  11. this.Weight = Weight;
  12. this.Time= Time;
  13. }
  14.  
  15.  
  16. //comparing the individual assignments to sort them
  17. public int compareTo(HomeworkProblem o) {
  18.  
  19. return 0;
  20. }
  21. }
  22.  
  23.  
  24. public static void main(String[] args) {
  25. Scanner KB = new Scanner(System.in);
  26. //array list storing all the assignments
  27. List<HomeworkProblem> myList = new ArrayList<HomeworkProblem>();
  28. int problems = 0, totalTests, tempWeight, tempTime;
  29. HomeworkProblem tempWeights;
  30. HomeworkProblem tempTimes;
  31. //nested loops reading in the input, in the correct format
  32. //first loop reads how many times the program must run
  33. //second loop reads how many homework problems need to be read
  34. //third loop reads weights for corresponding homework Problem
  35. //fourth loop reads times for corresponding problem
  36. totalTests = KB.nextInt();
  37. for(int i = 0; i < totalTests; i++){
  38. problems = KB.nextInt();
  39. for(int j = 0; j < problems; j++)
  40. tempWeights = KB.nextInt();
  41.  
  42. for(int k = 0; k < problems; k++)
  43. tempWeights= KB.nextInt();
  44. for(int l = 0; l < problems; l++)
  45. myList.add(tempWeights[l], tempTimes[l]);
  46. }
  47. }
  48.  
  49. }
Add Comment
Please, Sign In to add comment