Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Homework {
- //class creates the 2 data types needed
- class HomeworkProblem implements Comparable<HomeworkProblem>{
- // The difficulty of this homework problem.
- public int Weight;
- // How long it will take to do this homework problem.
- public int Time;
- public HomeworkProblem(int Weight, int Time){
- this.Weight = Weight;
- this.Time= Time;
- }
- //comparing the individual assignments to sort them
- public int compareTo(HomeworkProblem o) {
- return 0;
- }
- }
- public static void main(String[] args) {
- Scanner KB = new Scanner(System.in);
- //array list storing all the assignments
- List<HomeworkProblem> myList = new ArrayList<HomeworkProblem>();
- int problems = 0, totalTests, tempWeight, tempTime;
- HomeworkProblem tempWeights;
- HomeworkProblem tempTimes;
- //nested loops reading in the input, in the correct format
- //first loop reads how many times the program must run
- //second loop reads how many homework problems need to be read
- //third loop reads weights for corresponding homework Problem
- //fourth loop reads times for corresponding problem
- totalTests = KB.nextInt();
- for(int i = 0; i < totalTests; i++){
- problems = KB.nextInt();
- for(int j = 0; j < problems; j++)
- tempWeights = KB.nextInt();
- for(int k = 0; k < problems; k++)
- tempWeights= KB.nextInt();
- for(int l = 0; l < problems; l++)
- myList.add(tempWeights[l], tempTimes[l]);
- }
- }
- }
Add Comment
Please, Sign In to add comment