Questions
Consider the following variant of the Interval Scheduling problem. There are n jobs and each job...

Consider the following variant of the Interval Scheduling problem. There are n jobs and each job has a start time si and an end time fi . There is a single machine that can run at most one job at any given time. The jobs are now daily jobs. Once accepted, it must run continuously every day between its start and end times. (Note that a job can start before midnight and end after midnight.)

a) Design an algorithm that accepts as many jobs as possible. Your algorithm should run in time O(n 2 ) and output an optimal schedule (a set of intervals).

b) Prove the correctness of your algorithm and analyze its running time.

Example: Suppose there are 4 jobs, specified by (start-time, end-time) pairs: (9pm, 3am), (6pm, 6am), (3am, 1pm), and (2pm, 7pm). The optimal solution would be to pick 3 jobs (9pm, 3am), (3am, 1pm), and (2pm, 7pm), which can be scheduled without overlapping. (Hint: first enumerate an interval Ij = 1, . . . , n. How could we compute a schedule Oj with maximum size among all valid schedules that contain Ij?)

In: Computer Science

JAVA - PLEASE COMMENT CODE - THANK YOU: Implement a program that can input an expression...

JAVA - PLEASE COMMENT CODE - THANK YOU:

Implement a program that can input an expression in postfix notation and output its value.

In: Computer Science

Exercise 1: You are required to re-write the following code to catch the exception that can...

Exercise 1:

You are required to re-write the following code to catch the exception that can occur.

import java.util.Scanner;

public class ExceptionDemo

{

public static void main(String[] args)

{

Scanner scanner = new Scanner(System.in);

System.out.print("Enter an integer: ");

int number = scanner.nextInt();

// Display the result

System.out.println( "The number entered is " + number);

          }

}

In: Computer Science

Exercise 2: Try-Catch Exercise Write a Java code that does the following: Create a class MyClass...

Exercise 2:

Try-Catch Exercise

Write a Java code that does the following:

Create a class MyClass and create three methods myMethod1(), Method2() and Method3().

Invoke Method2() from Method1() and Method3() from Method2().

Write a code that can throw an exception inside myMethod3() and compile:

File file=new File("filename.txt");

Scanner sc=new Scanner(file);

You will get compilation errors now, as you are not handling a checked exception FileNotFoundException.

Declare throws over myMethod3() and myMethod2(). You will need to add throws FileNotFoundException on myMethod() as:

public void myMethod3() throws FileNotFoundException

{

File file=new File("filename.txt");

Scanner sc=new Scanner(file);

}

Handle the exception in myMethod1() by enclosing the code that can throw exception using a try-catch block:

public void myMethod1()

{

try{

myMethod2();

}

catch(FileNotFoundException e)

{

e.printStackTrace();

}

}

In: Computer Science

The following variables are declared as follow: int Var1 = 9, Var2 = 2, Var3 =...

The following variables are declared as follow:

int Var1 = 9, Var2 = 2, Var3 = 0;

What will the output of the following statements be?

Var3 = Va1 / Var2;

Var2 = Var2 / Var1;

out.print(Var3);
out.print(Var2);
int Var1 = 19, Var2 = 12,

oy.print(Var1 % Var2);
oy.print(Var1 % 3.0);
3. Var1 += 5;

System.oy.print(Var1);

In: Computer Science

whats the purpose of data warehouse design ? how is dimensional data models implemented in a...

whats the purpose of data warehouse design ?

how is dimensional data models implemented in a database covering relation implementation and multidemensional implementation.

In: Computer Science

List the product name and description of every product with a list price higher than $500...

List the product name and description of every product with a list price higher than $500 that has either the word “humbuck” or “fret” in the description. Use a regular expression to do this.


my guitar shop

In: Computer Science

List five types of files (e.g., JS) that have special meaning in web servers/web pages, and...

List five types of files (e.g., JS) that have special meaning in web servers/web pages, and explain briefly the role of each of the file types.

explain the hierarchy of network protocols used by web browsers/web servers, starting from the low level (IP) up to the high level (HTTP), with a brief explanation of each one.

In: Computer Science

JAVA Program The program below the text reads in the pet type …dog, cat or other...

JAVA Program

The program below the text reads in the pet type …dog, cat or other (only the words dog, cat, other) and the appointment amount. It is supplied as a beginning code to the assignment:

_______________________________________________________________
pet_lab package; 
import javax.swing.JOptionPane; 
public class pet_lab 
{ 

        public static void main (String [] args) 
        { 
                String pet, temp; 
                double payment; 
                pet = JOptionPane.showInputDialog (null, 
                 "Enter the pet type", "", JOptionPane.QUESTION_MESSAGE); 
                temp = JOptionPane.showInputDialog (null, 
                "Enter the payment for the appointment", "", JOptionPane.QUESTION_MESSAGE); 
            payment = Double.parseDouble (temp); 
            System.exit (0); 
        } 
}
_______________________________________________________________

You are to make the following changes:

  • Add a loop that reads data until the user wishes to stop
  • Count and print the number of dogs, cats and other pets
  • Calculate and print the total paid for dogs, cats and other pets
  • Calculate and print the total payment of all pets seen
  • Print which pet is seen the most, dogs, cats, or other

Please paste both the java code, a screenshot of the same code, and a screenshot/pasting of the final answer. Using this to check my Java data. Thanks!

In: Computer Science

Hi ERP experts! I am looking for ERP failure implementation cases. Specifically, I need suggestions of...

Hi ERP experts! I am looking for ERP failure implementation cases. Specifically, I need suggestions of cases, so I can summarize key factors influencing the success of the Sales & Marketing ERP module implementation.

In: Computer Science

Analysis and Discussion about if, if else, else if statement and Switch C programming write on...

Analysis and Discussion about if, if else, else if statement and Switch C programming write on your computer font

In: Computer Science

Java does not have a retry keyword like Ruby. How can we implement the same sort...

Java does not have a retry keyword like Ruby. How can we implement the same sort of functionality?

In: Computer Science

Create a view that will display the student id, name, event id, category, and score for...

Create a view that will display the student id, name, event id, category, and score for all

events for students who scored a 70 or below on any test. Call this view

atriskstudents.

a. What code did you write for this view? Insert the snip of the contents of the view SQL

code here:

b. Using this view, display those students who earned a score of 65 or greater. Insert your

snip here

***********************************************************************************************************************************************************

***********************************************************************************************************************************************************

CREATE DATABASE Class;


#-- Using the database

USE Class;

# create student table


DROP TABLE IF EXISTS student;

CREATE TABLE student

(
  
name VARCHAR(20) NOT NULL,
  
gender ENUM('F','M') NOT NULL,
  
student_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  
PRIMARY KEY (student_id)

);

# create grade event table

DROP TABLE IF EXISTS grade_event;

CREATE TABLE grade_event

(
  
date DATE NOT NULL,
  
category ENUM('T','Q') NOT NULL,
  
event_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  
PRIMARY KEY (event_id)

);

# create score table


# The PRIMARY KEY comprises two columns to prevent any combination
# of event_id/student_id from appearing more than once.


DROP TABLE IF EXISTS score;


CREATE TABLE score

(
  
student_id INT UNSIGNED NOT NULL,
  
event_id INT UNSIGNED NOT NULL,
  
score INT NOT NULL,
  
PRIMARY KEY (event_id, student_id),
  
INDEX (student_id),
  
FOREIGN KEY (event_id) REFERENCES grade_event (event_id),
  
FOREIGN KEY (student_id) REFERENCES student (student_id)

);

# create absence table


DROP TABLE IF EXISTS absence;

CREATE TABLE absence

(
  
student_id INT UNSIGNED NOT NULL,
  
date DATE NOT NULL,
  
PRIMARY KEY (student_id, date),
  
FOREIGN KEY (student_id) REFERENCES student (student_id)

);

#--Populate the student table


INSERT INTO student VALUES ('Megan','F',NULL);

INSERT INTO student VALUES ('Joseph','M',NULL);

INSERT INTO student VALUES ('Kyle','M',NULL);

INSERT INTO student VALUES ('Katie','F',NULL);

INSERT INTO student VALUES ('Abby','F',NULL);

INSERT INTO student VALUES ('Nathan','M',NULL);

INSERT INTO student VALUES ('Liesl','F',NULL);

INSERT INTO student VALUES ('Ian','M',NULL);

INSERT INTO student VALUES ('Colin','M',NULL);

INSERT INTO student VALUES ('Peter','M',NULL);

INSERT INTO student VALUES ('Michael','M',NULL);

INSERT INTO student VALUES ('Thomas','M',NULL);

INSERT INTO student VALUES ('Devri','F',NULL);

INSERT INTO student VALUES ('Ben','M',NULL);

INSERT INTO student VALUES ('Aubrey','F',NULL);

INSERT INTO student VALUES ('Rebecca','F',NULL);

INSERT INTO student VALUES ('Will','M',NULL);

INSERT INTO student VALUES ('Max','M',NULL);

INSERT INTO student VALUES ('Rianne','F',NULL);

INSERT INTO student VALUES ('Avery','F',NULL);

INSERT INTO student VALUES ('Lauren','F',NULL);

INSERT INTO student VALUES ('Becca','F',NULL);

INSERT INTO student VALUES ('Gregory','M',NULL);

INSERT INTO student VALUES ('Sarah','F',NULL);

INSERT INTO student VALUES ('Robbie','M',NULL);

INSERT INTO student VALUES ('Keaton','M',NULL);

INSERT INTO student VALUES ('Carter','M',NULL);

INSERT INTO student VALUES ('Teddy','M',NULL);

INSERT INTO student VALUES ('Gabrielle','F',NULL);

INSERT INTO student VALUES ('Grace','F',NULL);

INSERT INTO student VALUES ('Emily','F',NULL);


#--Populate grade event table

INSERT INTO grade_event VALUES('2015-09-03', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-09-06', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-09-09', 'T', NULL);
INSERT INTO grade_event VALUES('
2015-09-16', 'Q', NULL);
INSERT INTO grade_event VALUES(
'2015-09-23', 'Q', NULL);
INSERT INTO grade_event VALUES('
2015-10-01', 'T', NULL);


#--Populate the score table


INSERT INTO score VALUES (1,1,20);

INSERT INTO score VALUES (3,1,20);

INSERT INTO score VALUES (4,1,18);

INSERT INTO score VALUES (5,1,13);

INSERT INTO score VALUES (6,1,18);

INSERT INTO score VALUES (7,1,14);

INSERT INTO score VALUES (8,1,14);

INSERT INTO score VALUES (9,1,11);

INSERT INTO score VALUES (10,1,19);

INSERT INTO score VALUES (11,1,18);

INSERT INTO score VALUES (12,1,19);

INSERT INTO score VALUES (14,1,11);

INSERT INTO score VALUES (15,1,20);

INSERT INTO score VALUES (16,1,18);

INSERT INTO score VALUES (17,1,9);

INSERT INTO score VALUES (18,1,20);

INSERT INTO score VALUES (19,1,9);

INSERT INTO score VALUES (20,1,9);

INSERT INTO score VALUES (21,1,13);

INSERT INTO score VALUES (22,1,13);

INSERT INTO score VALUES (23,1,16);

INSERT INTO score VALUES (24,1,11);

INSERT INTO score VALUES (25,1,19);

INSERT INTO score VALUES (26,1,10);

INSERT INTO score VALUES (27,1,15);

INSERT INTO score VALUES (28,1,15);

INSERT INTO score VALUES (29,1,19);

INSERT INTO score VALUES (30,1,17);

INSERT INTO score VALUES (31,1,11);

INSERT INTO score VALUES (1,2,17);

INSERT INTO score VALUES (2,2,8);

INSERT INTO score VALUES (3,2,13);

INSERT INTO score VALUES (4,2,13);

INSERT INTO score VALUES (5,2,17);

INSERT INTO score VALUES (6,2,13);

INSERT INTO score VALUES (7,2,17);

INSERT INTO score VALUES (8,2,8);

INSERT INTO score VALUES (9,2,19);

INSERT INTO score VALUES (10,2,18);

INSERT INTO score VALUES (11,2,15);

INSERT INTO score VALUES (12,2,19);

INSERT INTO score VALUES (13,2,18);

INSERT INTO score VALUES (14,2,18);

INSERT INTO score VALUES (15,2,16);

INSERT INTO score VALUES (16,2,9);

INSERT INTO score VALUES (17,2,13);

INSERT INTO score VALUES (18,2,9);

INSERT INTO score VALUES (19,2,11);

INSERT INTO score VALUES (21,2,12);

INSERT INTO score VALUES (22,2,10);

INSERT INTO score VALUES (23,2,17);
INSERT INTO score VALUES (24,2,19);

INSERT INTO score VALUES (25,2,10);

INSERT INTO score VALUES (26,2,18);

INSERT INTO score VALUES (27,2,8);

INSERT INTO score VALUES (28,2,13);

INSERT INTO score VALUES (29,2,16);

INSERT INTO score VALUES (30,2,12);

INSERT INTO score VALUES (31,2,19);

INSERT INTO score VALUES (1,3,88);

INSERT INTO score VALUES (2,3,84);

INSERT INTO score VALUES (3,3,69);

INSERT INTO score VALUES (4,3,71);

INSERT INTO score VALUES (5,3,97);

INSERT INTO score VALUES (6,3,83);

INSERT INTO score VALUES (7,3,88);
INSERT INTO score VALUES (8,3,75);

INSERT INTO score VALUES (9,3,83);

INSERT INTO score VALUES (10,3,72);
INSERT INTO score VALUES (11,3,74);

INSERT INTO score VALUES (12,3,77);

INSERT INTO score VALUES (13,3,67);
INSERT INTO score VALUES (14,3,68);

INSERT INTO score VALUES (15,3,75);

INSERT INTO score VALUES (16,3,60);

INSERT INTO score VALUES (17,3,79);

INSERT INTO score VALUES (18,3,96);

INSERT INTO score VALUES (19,3,79);

INSERT INTO score VALUES (20,3,76);

INSERT INTO score VALUES (21,3,91);

INSERT INTO score VALUES (22,3,81);

INSERT INTO score VALUES (23,3,81);

INSERT INTO score VALUES (24,3,62);

INSERT INTO score VALUES (25,3,79);

INSERT INTO score VALUES (26,3,86);

INSERT INTO score VALUES (27,3,90);

INSERT INTO score VALUES (28,3,68);

INSERT INTO score VALUES (29,3,66);

INSERT INTO score VALUES (30,3,79);

INSERT INTO score VALUES (31,3,81);

INSERT INTO score VALUES (2,4,7);

INSERT INTO score VALUES (3,4,17);

INSERT INTO score VALUES (4,4,16);

INSERT INTO score VALUES (5,4,20);

INSERT INTO score VALUES (6,4,9);

INSERT INTO score VALUES (7,4,19);

INSERT INTO score VALUES (8,4,12);

INSERT INTO score VALUES (9,4,17);

INSERT INTO score VALUES (10,4,12);

INSERT INTO score VALUES (11,4,16);

INSERT INTO score VALUES (12,4,13);

INSERT INTO score VALUES (13,4,8);

INSERT INTO score VALUES (14,4,11);

INSERT INTO score VALUES (15,4,9);

INSERT INTO score VALUES (16,4,20);

INSERT INTO score VALUES (18,4,11);

INSERT INTO score VALUES (19,4,15);

INSERT INTO score VALUES (20,4,17);

INSERT INTO score VALUES (21,4,13);

INSERT INTO score VALUES (22,4,20);

INSERT INTO score VALUES (23,4,13);

INSERT INTO score VALUES (24,4,12);
INSERT INTO score VALUES (25,4,10);

INSERT INTO score VALUES (26,4,15);

INSERT INTO score VALUES (28,4,17);

INSERT INTO score VALUES (30,4,11);

INSERT INTO score VALUES (31,4,19);

INSERT INTO score VALUES (1,5,15);

INSERT INTO score VALUES (2,5,12);

INSERT INTO score VALUES (3,5,11);

INSERT INTO score VALUES (5,5,13);

INSERT INTO score VALUES (6,5,18);

INSERT INTO score VALUES (7,5,14);

INSERT INTO score VALUES (8,5,18);

INSERT INTO score VALUES (9,5,13);

INSERT INTO score VALUES (10,5,14);

INSERT INTO score VALUES (11,5,18);

INSERT INTO score VALUES (12,5,8);

INSERT INTO score VALUES (13,5,8);

INSERT INTO score VALUES (14,5,16);

INSERT INTO score VALUES (15,5,13);

INSERT INTO score VALUES (16,5,15);

INSERT INTO score VALUES (17,5,11);

INSERT INTO score VALUES (18,5,18);

INSERT INTO score VALUES (19,5,18);
INSERT INTO score VALUES (20,5,14);

INSERT INTO score VALUES (21,5,17);

INSERT INTO score VALUES (22,5,17);

INSERT INTO score VALUES (23,5,15);

INSERT INTO score VALUES (25,5,14);

INSERT INTO score VALUES (26,5,8);

INSERT INTO score VALUES (28,5,20);

INSERT INTO score VALUES (29,5,16);

INSERT INTO score VALUES (31,5,9);

INSERT INTO score VALUES (1,6,100);

INSERT INTO score VALUES (2,6,91);

INSERT INTO score VALUES (3,6,94);

INSERT INTO score VALUES (4,6,74);

INSERT INTO score VALUES (5,6,97);

INSERT INTO score VALUES (6,6,89);

INSERT INTO score VALUES (7,6,76);

INSERT INTO score VALUES (8,6,65);

INSERT INTO score VALUES (9,6,73);

INSERT INTO score VALUES (10,6,63);

INSERT INTO score VALUES (11,6,98);

INSERT INTO score VALUES (12,6,75);

INSERT INTO score VALUES (14,6,77);

INSERT INTO score VALUES (15,6,62);

INSERT INTO score VALUES (16,6,98);

INSERT INTO score VALUES (17,6,94);

INSERT INTO score VALUES (18,6,94);

INSERT INTO score VALUES (19,6,74);
INSERT INTO score VALUES (20,6,62);

INSERT INTO score VALUES (21,6,73);

INSERT INTO score VALUES (22,6,95);

INSERT INTO score VALUES (24,6,68);

INSERT INTO score VALUES (25,6,85);

INSERT INTO score VALUES (26,6,91);
INSERT INTO score VALUES (27,6,70);

INSERT INTO score VALUES (28,6,77);

INSERT INTO score VALUES (29,6,66);

INSERT INTO score VALUES (30,6,68);

INSERT INTO score VALUES (31,6,76);


#--Populate the absence table

INSERT INTO `absence` VALUES (3,'2015-09-03');

INSERT INTO `absence` VALUES (5,'2015-09-03');

INSERT INTO `absence` VALUES (10,'2015-09-06');

INSERT INTO `absence` VALUES (10,'2015-09-09');

INSERT INTO `absence` VALUES (17,'2015-09-07');

INSERT INTO `absence` VALUES (20,'2015-09-07');

***********************************************************************************************************************************************************

***********************************************************************************************************************************************************

In: Computer Science

Research the development of input and output devices in computers

Research the development of input and output devices in computers

In: Computer Science

Create a generic function max() in C++, to find maximum of 3 generic type arguments, then...

Create a generic function max() in C++, to find maximum of 3 generic type arguments, then test this function with char, int and float type.

In: Computer Science