Create a scheduler that takes unlimited processes. It will ask for number of jobs, arrival time, and CPU burst time. It should use FCFS, SJF, and SRTF methods. It should also print out the gantt chart, waiting time, and turn around time for each of the processes. Please solve using Java.
In: Computer Science
Subject (DBA)
use MYSQL workbench select my guitar shop database as default schema
Question text
Problem10
Write a script that implements the following design in a database named household_chores:
Details
Solution
______ DATABASE IF EXISTS ______ ;
CREATE DATABASE household_chores CHARSET _________ ;
________ ;
______ _______ (
person_id INT PRIMARY KEY ______ ,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL
) ENGINE = InnoDB;
CREATE TABLE chores (
chore_id INT PRIMARY KEY _______
name VARCHAR(100) UNIQUE
) _______
CREATE TABLE tasks (
task_id INT PRIMARY KEY AUTO_INCREMENT,
chore_id INT,
name _______ UNIQUE,
CONSTRAINT fk_tasks_chores
_________
REFERENCES _______
) _______ = InnoDB;
CREATE TABLE assignments (
_______ INT PRIMARY KEY AUTO_INCREMENT,
person_id ______ ,
task_id INT,
_______ fk_assignments_people
_______
REFERENCES _______ ,
CONSTRAINT fk_assignments_tasks
______
_______ tasks (task_id)
_______
In: Computer Science
Q.4. A) How Data Dissemination in Vehicular Ad hoc Networks (VANETs) is achieved?
explain in detail
In: Computer Science
Using Python
Implement Recursive Selection Sort with the following recursive method.
1. Find the smallest number in the list and swaps it with the first number.
2.Ignore the first number and sort the remaining smaller list recursively.
In: Computer Science
Build a html form with the following elements. The form must be within a table structure.
• Current date: a non-editable
textbox and should be in the format as shown (e.g.
12 October 2020 Monday 05:35 PM)
• Number of weeks till end of the year: a label showing the total
number of weeks from now till 31st Dec 2020. (e.g. 17 days is 2
weeks and 3 days)
In: Computer Science
class listnodes{
int data;//first part of the node(data)
listnodes link;//second part of the node(address)
listnodes()
{
data=0;
link=null;
}
listnodes(int d,listnodes l)//10|null
{
data=d;
link=l;
}
}
class singlelinkedlist{
void display(listnodes head){
listnodes current=head;
while(current.link!=null){
System.out.print(current.data+"-->");
current=current.link;
}
System.out.print(current.data);
}
public listnodes insert(listnodes head,int data)
{
//create new node
listnodes newnode=new listnodes(data,null);
//link the newnode to the head node
newnode.link=head;
//make newnode the first node
head=newnode;
return head;//return the first node
}
//insert at a position(after or before a node)
public listnodes InsertAtPostion(listnodes head,int data,int
position){
listnodes newnode=new listnodes(data,null);
listnodes previous=head;
int count=1;
while(count<=position-1){//(count<position)
previous=previous.link;
count++;
}
// listnodess current=previous.link;
listnodes current=previous;
current=previous.link;
newnode.link=current;
previous.link=newnode;
return head;
}
public listnodes deletefirst(listnodes head){
listnodes temp=head;//rename
head=head.link;//move head
temp.link=null;//temp alone
return temp;
}
public listnodes deletelast(listnodes head){
if(head==null){
return head;
}
listnodes last=head;
listnodes previoustolast=head;
while(last.link!=null){
previoustolast=last;
last=last.link;
}
previoustolast.link=null;
return last;
}
public int length(listnodes head){
listnodes curr=head;
int c=0;
while(curr!=null){
c++;
curr=curr.link;
}
return c;
}
public boolean find(listnodes head,int searchkey){
listnodes curr=head;
while(curr!=null){
if(curr.data==searchkey)
{
return true;
}
curr=curr.link;
}
return false;
}
}
public class linkedlist {
public static void main(String[] args) {
//craete first node
listnodes head=new listnodes(10,null);
//create an object of class where all the methods are
singlelinkedlist sl=new singlelinkedlist();
//insert at postion
sl.InsertAtPostion(head, 30, 1);
//insert at front
listnodes newhead=sl.insert(head,20);
sl.display(newhead);
//delete last
System.out.println(" ");
System.out.println("Delete a node at end");
listnodes l=sl.deletelast(head);
sl.display(l);
System.out.println(" ");
//delete first
System.out.println("\nDelete a node at begining and return head:
\n");
listnodes first=sl.deletefirst(head);
sl.display(first);
System.out.println(" \n");
//find length
System.out.println("length is="+sl.length(head));
System.out.println(" ");
//Search a node
System.out.println("Search for a node");
if(sl.find(head, 10)){
System.out.println("key found");}
else
System.out.println("key not found");
}
}
ON THIS CODE
Write an application and perform the following:
-Create at least three classes such as:
1. listnode- for data and link, constructors
2. Singlelinkedlist-for method definition
3. linkedlist-for objects
-Insert a node at tail/end in a linked list.
-and display all the nodes in the list.
-Delete a node at a position in the list
In: Computer Science
Java
How to read a comma separated value file using Scanner
for example Scanner sc = new Scanner(filename);
I need to assign each value separated by a comma to different variable types.
I need a good example to know how it works and implement it in my project
Please only use Scanner to read the file
In: Computer Science
Task 6.2.1. For each publisher with more than $2000 in purchase orders, list the customer id, name, credit code, and total of the orders. Use a WHERE clause to perform the join across the five required tables.
DROP TABLE publishers;
DROP TABLE po_items;
DROP TABLE bookjobs;
DROP TABLE items;
DROP TABLE pos;
CREATE TABLE publishers (
cust_id CHAR(3) NOT NULL,
name CHAR(10),
city CHAR(10),
phone CHAR(8),
creditcode CHAR(1),
PRIMARY KEY (cust_id)
);
CREATE TABLE bookjobs (
job_id CHAR(3) NOT NULL,
cust_id CHAR(3),
job_date DATE,
descr CHAR(10),
jobtype CHAR(1),
PRIMARY KEY (job_id),
FOREIGN KEY (cust_id) REFERENCES publishers (cust_id)
);
CREATE TABLE pos (
job_id CHAR(3) NOT NULL,
po_id CHAR(3) NOT NULL,
po_date DATE,
vendor_id CHAR(3),
PRIMARY KEY (job_id, po_id),
FOREIGN KEY (job_id) REFERENCES bookjobs (job_id)
);
CREATE TABLE items (
item_id CHAR(3) NOT NULL,
descr CHAR(10),
on_hand SMALLINT,
price DECIMAL(5,2),
PRIMARY KEY (item_id)
);
CREATE TABLE po_items (
job_id CHAR(3) NOT NULL,
po_id CHAR(3) NOT NULL,
item_id CHAR(3) NOT NULL,
quantity SMALLINT,
FOREIGN KEY (job_id) REFERENCES bookjobs (job_id),
FOREIGN KEY (job_id, po_id) REFERENCES pos (job_id, po_id),
FOREIGN KEY (item_id) REFERENCES items (item_id)
);
In: Computer Science
EER diagram
Draw the EER diagram for the following systems.
Persons in an organization are employees or customers or
visitors. Employees have computers.
The IT department of the company builds all its computers from
components. Each computer
consists of several components like graphic cards, network cards,
mother boards, memory
capsules, hard discs, etc. When a component is bought from a
supplier it is given an ID number.
The finished computer is placed in a room, which may contain
several computers.
Prepare an EER diagram using only the concepts listed above, that
shows, as necessary,
entities, relationships, specializations and generalizations. Show
the most likely cardinalities
(min, max) for all relationships.
In: Computer Science
JAVAFX
You will create a GUI that solves the quadratic equation shown below.
Part 1: Create the GUI 25%
Create a user interface that offers the user a space to enter values for A, B, and C. (Use a different text field for each.) Be sure to either set the text in these so that the user knows which is for A, which is for B, and which is for C or add labels so that it is clear.
Create a button that the user will press to generate the answers. (Or make sure it’s clear how the user should submit their values in another way.)
Create a node that will display both X values that result from the math. This can be 2 labels, a single label, a Text object… whatever.
Put these in a simple layout and make sure everything displays before moving on. Add enough styling so that things look neat.
Part 2: Add EventHandler 75%
After your nodes are created but before your scene and stage commands, add
an event handler. I would like it to be an ActionEvent type.
Inside of the handle method, you will get the values from A, B, and C and solve for both X values. Make sure you store A, B, and C as doubles, not integers. Display the two answers that you get back to the GUI. There will be times where X will have no values. Handle this as addressed below.
Be sure to check first to see if A has a 0 in it. If it does, the math should not be performed and the user should be informed that A cannot be 0.
Also check to see if the discriminant is negative. This is the part that occurs under the square root. We know that if it’s negative, then finding the square root of it will result in an imaginary number. Your program won’t crash if this happens but Java will display either ??? or NaN. Have the program check the discriminant before continuing with the math and display a custom message if the discriminant is negative.
The only acceptable printed outcomes are: a message saying A cannot be 0; a message saying that the inputted values will result in an imaginary number; or the two X values that result from the equation.
One final task: Make sure both X answers are formatted to three decimal places. You can use String.format(), which was covered in Lab 1, the DecimalFormat class, or any other means for displaying 3 decimal places accurately.
Test values are below.
A: 3.0, B: 5.0, C: -2.0 → X = -2.000 and X = 0.333
A: -3.0, B: 10.0, C: 8.0 → X = 4.000 and X = -0.666
In: Computer Science
I am trying to create a program That works with two other programs in c++ and a makefile.
Only Shape.cpp can be modified. and it needs to work on a unix machine. It isn't running on my machine. And gives me an error message that it doesn't recomize cin and endl
The program will accept a character and an X and Y coordinate. Dependign on the Charactor, It will then tell you what Cells that shape occupies.
I almost have the program working, but I am getting several bugs. Can someone fix the Shape.cpp file, and tell me what they did to fix it?
Thanks.
all: testShape
CXXFLAGS=-g -Wall
Shape.o: Shape.cpp Shape.h
testShape.o: testShape.cpp Shape.h
testShape: testShape.o Shape.o
$(CXX) -o $@ $^ $(LDFLAGS)
clean:
rm -f *.o testShape
// end of makefile
//
// testShape.cpp
//DO NOT MODIFY
#include "Shape.h"
#include
#include
using namespace std;
int main()
{
Shape *t1, *t2;
char ch;
int x,y;
try
{
cin >> ch >> x >> y;
t1 = Shape::makeShape(ch,x,y);
t1->print();
cin >> ch >> x >> y;
t2 = Shape::makeShape(ch,x,y);
t2->print();
t2->move(1,-1);
t2->print();
if ( t1->overlap(*t2) )
cout << "overlap" << endl;
else
cout << "no overlap" << endl;
delete t1;
delete t2;
}
catch ( invalid_argument &exc )
{
cout << exc.what() << ": " << ch << " "
<< x << " " << y << endl;
}
}
//end of testshape
//
// Shape.h
// DO NOT MODIFY
#ifndef SHAPE_H
#define SHAPE_H
class Shape
{
public:
virtual ~Shape(void);
virtual char name(void) const = 0;
virtual int size(void) const = 0;
void print(void) const;
void move (int dx, int dy);
bool overlap(const Shape &t) const;
static Shape *makeShape(char ch,int posx,int posy);
protected:
int *x, *y;
};
class O: public Shape
{
public:
O(int posx, int posy);
virtual char name(void) const;
virtual int size(void) const;
};
class I: public Shape
{
public:
I(int posx, int posy);
virtual char name(void) const;
virtual int size(void) const;
};
class L: public Shape
{
public:
L(int posx, int posy);
virtual char name(void) const;
virtual int size(void) const;
};
class S: public Shape
{
public:
S(int posx, int posy);
virtual char name(void) const;
virtual int size(void) const;
};
class X: public Shape
{
public:
X(int posx, int posy);
virtual char name(void) const;
virtual int size(void) const;
};
class U: public Shape
{
public:
U(int posx, int posy);
virtual char name(void) const;
virtual int size(void) const;
};
#endif
//end of shape.h
// THIS IS THE FILE I NEED HELP WITH Shape.cpp
#ifndef SHAPE_CPP
#define SHAPE_CPP
#include "Shape.h"
// Constructor for O
O::O(int posx, int posy)
{
x = new int[1];
y = new int[1];
x[0] = posx;
y[0] = posy;
}
char O::name() const
{
return 'O';
}
int O::size() const
{
return 1;
}
// Constructor for I
I::I(int posx, int posy)
{
x = new int[2];
y = new int[2];
x[0] = x[1] = posy;
y[0] = posy;
y[1] = posy+1;
}
char I::name() const
{
return 'I';
}
int I::size() const
{
return 2;
}
// Constructor for L
L::L(int posx, int posy)
{
x = new int[3];
y = new int[3];
x[0] = x[2] = posx;
y[0] = y[1] = posy;
x[1] = posx+1;
y[2] = posy+1;
}
char L::name() const
{
return 'L';
}
int L::size() const
{
return 3;
}
// Constructor for S
S::S(int posx, int posy)
{
x = new int[4];
y = new int[4];
x[0] = posx;
x[1] = posx+1;
x[2] = posx+2;
x[3] = posx+3;
y[0] = y[1] = posy;
y[2] = y[3] = posy+1;
}
char S::name() const
{
return 'S';
}
int S::size() const
{
return 4;
}
/*
Constructor for X
the constructor initialises the cell co-ordinates
X is spread across 5 cells
*
* * *
*
The Numbering of cells is done from bottom-top and
left to right
(x[0], y[0]) is the position of bottom most cell
(x[1], y[1]) is the position of left most cell of the
2nd row from bottom
(x[2], y[2]) is the position of the middle cell in the
2nd row from bottom
....
*/
X::X(int posx, int posy)
{
x = new int[5];
y = new int[5];
x[0] = x[2] = x[4] =posx;
x[1] = posx-1;
x[3] = posx+1;
y[0] = posy;
y[1] = y[2] = y[3] = posy+1;
y[4] = posy+2;
}
char X::name() const
{
return 'X';
}
int X::size() const
{
return 5;
}
// Constructor for U
U::U(int posx, int posy)
{
x = new int[7];
y = new int[7];
x[0] = x[3] = x[5] = posx;
x[1] = posx+1;
x[2] = x[4] = x[6] = posx+2;
y[0] = y[1] = y[2] = posy;
y[3] = y[4] = posy+1;
y[5] = y[6] = posy+2;
}
char U::name() const
{
return 'U';
}
int U::size() const
{
return 7;
}
void Shape::print() const
{
//get the size of the object i.e no of cells across
which this is spread
int sz = size();
// get the type of object i.e O, L, X...
char n = name();
cout<
//Print all the cell co-ordinates for this
object
for(int i = 0 ; i < sz ; i++)
{
cout<<"("<
if(i != sz-1)
cout<<"
";
}
cout< }
void Shape::move(int dx, int dy)
{
int sz = size();
for(int i = 0 ; i < sz ; i++)
{
x[i] += dx;
y[i] += dy;
}
}
/*
This function checks if the object(this) and t
overlap
* First add all the cells of t to a set
* the iterate over all the cells of (this) and
check
if they are already present in the set
* If any of the cell is already present , objects
overlap
and return true
*/
bool Shape::overlap(const Shape &t) const
{
set > st;
int sz1 = t.size();
int sz2 = size();
for(int i = 0 ; i < sz1 ; i++)
{
st.insert(make_pair(t.x[i],
t.y[i]));
}
for(int i = 0 ; i < sz2 ; i++)
{
if(st.find(make_pair(x[i], y[i]))!=
st.end())
return
true;
}
return false;
}
/*
This function creates a new object of type ch
*/
Shape * Shape::makeShape(char ch, int posx, int posy)
{
if(ch == 'O')
return new O(posx, posy);
else if(ch == 'I')
return new I(posx, posy);
else if(ch == 'L')
return new L(posx, posy);
else if(ch == 'S')
return new S(posx, posy);
else if(ch == 'X')
return new X(posx, posy);
else if(ch == 'U')
return new U(posx, posy);
else
throw std::invalid_argument("Invalid syntax.");
}
// base class virtual destructor
Shape::~Shape()
{
delete [] x;
delete [] y;
}
#endif
In: Computer Science
Last week we observed a shopkeeper going about their daily routine and made some observations. This week we will collect some user requirements either through an interview or a questionnaire (Your choice although the interview is much faster).
Find out what the shopkeepers challenges are, how their work can be made easier (think stock keeping, accounting, sales, ordering the possibilities are endless). Concentrate on one area and using the information you collect extract the requirements for the system. Using this information, create a persona for the shopkeeper.
In: Computer Science
Write the c++ program of Bisection Method and False Position Method and newton Raphson method in a one program using switch condition .Like :
cout<<"1.Bisection Method \n 2.False Position Method\n3.Newton Raphson method"<<endl; if press 1 then work Bisection Method code if press 2 then workFalse Position Method if press 3. work Newton Raphson method .so please writhe the code in c++ using switch case.and the equation given down consider the equation in the given.Note: Must showt the all the step of output all the iteration step shown in the program .in program must shown all the step of iteration result like every iteration x1,x2,x3 must be shown in program.
f(x)=3x-cosx-1;
Please in every itaration must be shown the output then finally Got the root
In: Computer Science
In: Computer Science
Q3# Briefly provide the answers to the following questions?
(a) Define overfitting.
(b) List causes of overfitting in neural networks.
(c) How can overfitting be avoided in neural nertworks?
In: Computer Science