Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Submit all the java files needed for this question. In this question, you need to access the following database. Server: sgt11.freemysqlhosting.net Database Name: sql11461895 Username:

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Submit all the java files needed for this question. In this question, you need to access the following database. Server: sgt11.freemysqlhosting.net Database Name: sql11461895 Username: sql11461895 Password: 62212Becsk Port number: 3306 There is only one table in this database named Students. So an SQL query to access the table would be "select * from sq 11461895. Students". 1.(12 pts) Create a Student ArrayList allStudents that stores all the information available on the database. Each row should be associated with a Student object. Use a constructor that takes the inputs from a row, and creates the associated object. Do not use an additional method inside the Student class for this part of the question. 2. (5 pts) Include a boolean variable for Student class named satisfactory that takes value true if GPA of the student is above 2. You should decide if a student is satisfactory or not inside the constructor. Do not use an additional method for this part of the question. 3. (8 pts) in this part, create a printUnsatisfactory method inside Student dass, which prints out the name of the student with a meaningful sentence such as "Student X is not successful." This message should be printed only if that student is unsatisfactory If the student is satisfactory, do not print anything. Next, write an enhanced-for loop in the main method to call printUnsatisfactory for each student in all students and report your output. You can report your output by copying and pasting in a commented out section under the main method. Laimut size for new files: SOOMB (25 pts) Submit all the java files needed for this question. There are a number of machines (numbered 1 to M) and a number of tasks (numbered 1 to T), Suppose that M-5, and T-10. Create Machine and Task objects with integer ids (machine and task numbers) that are assigned at the constructor. So the machines will have ids 1 to 5, and tasks will have ids 1 to 10. For instance when we say machine 3, that is the machine with id 3. Taskt takes t hours to complete regardless of the machine it is assigned to. That is task 1 takes 1 hours to complete, 2 takes 2 hours to complete, 3 takes 3 hours to complete, etc. Use an integerto store hours to complete inside the Task class, which takes a value inside the constructor. Each machine has 12 hours of capacity. Store the capacity value inside the machine class, which will always take integer values. Set that value inside the constructor for each object as well Machines can only be assigned to perform certain tasks as follows: machine 1 can perform all tasks 1 to T. machine 2 can only perform tasks 2 to T, machine 3 can only perform tasks 3 to T. etc. For this use a method named isCompatible that takes one Machine and one Task object and returns a boolean by comparing machine and task numbers, and returns true if and only if the machine number is less than or equal to the task number Finally, assume that the cost of assigning machine m to taskrism 13. For this use a method that takes one Machine and one Task object and returns a double by comparing machine and task numbers, and returns the multiplication of machine and task number divided by 3. Find the minimum cost task-machine assignment that does not violate the capacity and compatibility constraints using Gurobi and report the solution. You can report the solution in any format but we should see the answer on the screen after running the code. Also copy this output in a commented out section under the main method, for SOME (25 pts) Submit all the java files needed for this question. Create a "restricted knapsack problem" randomly. You don't need to solve the problem. Here are the requirements: let the number of items considered in this problem be randomly generated between 10 and 20. For each item, create an Item object that has itemid, profit, and volume values. For each item, create an item id depending on the order you create these objects, starting with 1. The profit of each item should be 3 with probability 65% and 5.5 with probability 35%. The volume of each item should be a double value between 9 and 17 The knapsack capacity should be an integer between 198 and 201. One final requirement is that some items cannot be included in the knapsack at the same time, hence the name restricted knapsack. That information will be stored in a HashMap named coExist that provides a boolean to indicate if a pair of items can be included together. We check the id of items, and if one id is divisible by the other the items cannot co-exist in the knapsack That means for instance both items 3 and 6 cannot be included together in the final solution because 6 is divisible by 3. Likewise, items 2 and 4 or 2 and 8 cannot be included together in the final solution. Item 1 can only be included alone as a solution, as all other item numbers will be divisible by 1. Create a HashMap named coExist and populate the boolean values for all pairs of itemids, so that when we try coexist.get(3).get(6) or coexist.get(6).get(3) of coExist get11 get(5) or coExist.get(4).get(2) we obtain false. However, coexist.get(6) get/5) would be true as items 5 and 6 can be included in the knapsack together Maximunist forms 500MB E- Answer the following questions in the provided text box, clearly indicating parts A. B, C, D. A) (8 pts) Write a method that takes two integers (say intOne and intTwo) and a HashMap Integer, String as inputs and returns the HashMap after an update. The update is that if intone is a key in the given HashMap this method should change that key to intTwo, . B)(8 pts) Suppose that we have the following objects in the main method: HashMap item, ArrayList> myDear Hashimap trem myDearitem Agent myDearAgent Write a code block in the main method that finds the entry whose key is myDearitem and adds myDearAgent into the list of iterns. Note: If an entry (ArrayList) is null, you will need to initialize and add my DearAgent as the first Agent in the list. C) (5 pts) Suppose that we have the following objects in the main method: ArrayListAgent my Dear ArrayList Agent myDeatAgent Write a code block in the main method that replaces the second agent in myDear ArrayList indexed 1) with my Dearagent. If there is no second agent no update is needed. . D) 4 pts Suppose that we have the following objects in the main method ArrayList Daylist Dent wa code block the method that is the fun ber of times my Deargent appears on my Dear ArrayList

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

User Defined Tensor Data Analysis

Authors: Bin Dong ,Kesheng Wu ,Suren Byna

1st Edition

3030707490, 978-3030707491

More Books

Students also viewed these Databases questions

Question

b. What groups were most represented? Why do you think this is so?

Answered: 1 week ago

Question

3. Describe phases of minority identity development.

Answered: 1 week ago

Question

5. Identify and describe nine social and cultural identities.

Answered: 1 week ago