The following processes are being scheduled using a preemptive, priority-based, round-robin scheduling algorithm. Each process is assigned a numerical priority,with a higher number indicating a higher relative priority. The scheduler will execute the highest-priority process. For processes with the same priority, a round-robin scheduler will be used with a time quantum of 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue.
Process Burst Time Arrival Time Priority
P1 15 0 8
P2 20 0 3
P3 20 20 4
P4 20 25 4
P5 5 45 5
P6 15 55 5
What is the average turnaround time of these processes?
What is the average waiting time of these processes?
In: Computer Science
urgent!!! code in c++
- cannot use vector
- please use inheritance
-please identify the .h and .cpp files and add tester program and screenshot of output!
-please complete all parts I will upvote thank you!!!
Define the following classes to manage the booking of patients in a medical clinic.
a) Define a class Date that has the following integer data
members: month, day and year.
b) Define a class AppointmentTime that has the following data
members: day (string), hour (int) and minute (int).
c) Define a class Patient with the following data members:
The name of the patient as a standard library string.
The date of birth of the patient (from part a).
Medical insurance number of the patient as a standard library string.
Name of the doctor for the appointment.
Day and time of the appointment (from part b).
A patient may have a single doctor’s appointment each week.
The name of the doctor as a standard library string.
The date of birth of the doctor (from part a).
A two-dimensional string pointer array of 12-by-5 that shows the appointments of that doctor. The appointment durations are 30 mins and they always begin on the hour or half hour. Doctors see patients Monday to Friday during 9.00-12.00 and 14.00-17.00. This array is initialized to empty strings to indicate that at the beginning all the appointments are available. When an appointment is given a pointer to the medical insurance of the patient is stored at that location.
A Patient object from part (b).
Doctor’s name.
The day that appointment is requested as a standard library string (Monday to Friday).
f) Define a class ClinicManager with the following data members:
An array of pointers to the Patient objects of size 200.
An array of pointers to the Doctor objects of size 20.
An integer variable that counts total number of patient
appointments given by the clinic in a week.
At least the following member functions should be provided,
A member function that receives a patient object and inserts it
to the Patient pointer array. It will check if the patient is
already in the array to prevent multiple copies of the patient
object in the array.
A member function that receives a doctor object and inserts to the
Doctor pointer array.
A member function that processes appointment requests. The function
will receive an AppointmentRequest object, then will check the
requested doctor’s schedule to determine if the appointment can be
made. If the appointment can be scheduled it will store the medical
insurance of the patient in the appointment array of that doctor.
It will create an AppointmentTime object from part b). Then, it
will find the patient in the Patient pointer array and store the
doctor’s name and AppointmentTime object in the patient object in
the Patient pointer array. Finally, the member function will return
the AppointmentTime object. If the doctor is already fully booked
on that day this object should should return zeros for the
appointment time.
A member function that cancels an appointment, receives doctor’s
name and medical insurance of the patient. Then it removes the
appointment both from the doctor’s schedule and from the
patient.
A member function that receives a doctor’s name as a parameter and
prints name and medical insurance number of all the patients that
have booked an appointment with that doctor.
g) Write a driver program that demonstrate the functionality of your program including:
- Creates a ClinicManager object
- Creates doctor objects and calls to the doctor insert member function.
- Creates Patient and AppointmentRequest objects and calls to the member functions that
processes the appointments, then outputs the time of the appointment.
§ You must enforce encapsulation by keeping all data members private.
§ You need to make sure that your classes are well defined using the various concepts
seen in the class.
§ Provide needed set/get functions for the data members.
§ Objects should be created dynamically and must be deleted when no longer needed. There should be an output statement confirming the deletion of an object from the destructor function.
In: Computer Science
In this assignment, you are going to write a Python program to demonstrate the IPO (Input-Process-Output) cycle that is the heart of many imperative programs used for processing large amount of data. Daisy is recently hired by a warehouse. One of her job is to keep track the items ordered by all the branches of the company. The company wants to automate the task using a computer program. Being a friend of Daisy, she knows you are a Computer Science major; so she recommended outsourcing the contract for writing the computer program to you. However, the timeline is short; and you only have less than three weeks to finish the job. The following is a description on the requirements:
• General requirements:
o The program you write must be a Python 3.x program, it cannot be written in any other language, not even in Python 2.x. You have to provide source code, and the company will run your program on a standard Python 3 implementation. Your program should produce no errors and/or warnings during execution.
o Your program will be a console program. There is no need to produce a window-based graphical user interface.
o Your program will have a main function named “main”. It takes two parameters. The first one being the name of the input data file, and the second is the name of the output result file; both are strings. You can assume that both the input and output files can be open without any problem. Therefore, there is no need to check for the result of opening the files.
• Input requirements:
o The input data file is guaranteed to contain only numbers and plus or minus sign, as well as the space and newline characters.
o The first line has only one (1) number, representing the number of items the system should manage. This number is guaranteed to be less than or equal to ten thousand (10,000).
o Each of the subsequence line is a transaction line which contains exactly two (2) numbers, separated by space characters. The first is an integer representing the item number (the items are numbered from 1 onward); and the second is an integer representing the quantity ordered by the branches. The two numbers are separated by one or more of space characters.
o The number of transaction lines is not known in advance but guaranteed to be less than or equal to 1 billion (1,000,000,000).
• Output requirements:
o For each order line read, you need to echo the line to the output, using the format '%5d %10d'.
o If the order data is not valid, you need to output the reason why it is not valid on the same line of the echo output, using the format '%5d %10d %s'. All invalid orders must be echoed but ignored in the processing.
o The following explain the error conditions (in the following, n represents the number of items involved, and “·” in the example outputs represents a space character):
▪ If the item number is not between 1 and n, inclusively, the item is invalid: ··141········878·invalid·item·number
▪ If the quantity is not a positive value, it is invalid: ···61·······-610·invalid·quantity
▪ If a line has multiple errors, only one error needed to be reported. The following shows the priority of errors, from high to low:
• Invalid item.
• Invalid quantity.
▪ The following example shows the echoed line in case of multiple errors: ··-12·······-922·invalid·item·number
o After you have echoed all order lines, you should output the number of valid orders in a separate line. There should be a blank line before and after this line. The format should be '%10d'.
o After that, you need to output a summary for all items, if and only if there are any orders for the item. The format, again, should be '%5d %10d'.
o All lines in the output file should have no trailing space or tab characters
----The input file is data-small.txt:
100
17 254
3 87
48 643
42 387
71 724
3 811
42 80
86 254
0 -107
97 135
86 518
35 91
24 146
82 312
73 348
2 842
3 671
141 878
22 361
45 405
3 580
-2 -224
73 341
52 828
69 662
41 759
53 924
39 175
0 805
-1 127
40 70
178 -652
26 486
38 814
0 -144
61 -610
72 162
97 711
91 522
14 660
33 520
19 895
91 664
20 776
5 490
72 356
62 290
94 636
80 352
96 606
----The output file is result-small.txt:
17 254
3 87
48 643
42 387
71 724
3 811
42 80
86 254
0 -107 invalid item number
97 135
86 518
35 91
24 146
82 312
73 348
2 842
3 671
141 878 invalid item number
22 361
45 405
3 580
-2 -224 invalid item number
73 341
52 828
69 662
41 759
53 924
39 175
0 805 invalid item number
-1 127 invalid item number
40 70
178 -652 invalid item number
26 486
38 814
0 -144 invalid item number
61 -610 invalid quantity
72 162
97 711
91 522
14 660
33 520
19 895
91 664
20 776
5 490
72 356
62 290
94 636
80 352
96 606
Number of Valid Orders = 42
Summary:
2 842
3 2149
5 490
14 660
17 254
19 895
20 776
22 361
24 146
26 486
33 520
35 91
38 814
39 175
40 70
41 759
42 467
45 405
48 643
52 828
53 924
62 290
69 662
71 724
72 518
73 689
80 352
82 312
86 772
91 1186
94 636
96 606
97 846
----Additional information and requirement:
1. Your program should contain at least three (3) top-level functions (including the “main” function). You probably will end up having more than 3 functions.
2. You cannot have any import statement in your program.
3. You cannot have any global variables
4. You cannot have any class definition in your program (this assignment is NOT about object-oriented programming).
5. You cannot have anything other than top-level function definitions in your program (not even a call to the main function – the tester will call it).
6. Since you only know the number of items when you run the program, you will need some sort of lists or matrices with dynamic storage to hold data.
7. Since there can be potentially up to 1 billion transactions in the input data file. You cannot read them all into a list and process them later (doing so may cause an out-of-memory error), you must process them as you read them in.
8. Your program must be a Python 3.x program.
9. You can assume that the input file contains no format error
This is my Python Code:
in_file = "data-small.txt"
out_file = "result-small.txt"
def main(in_file,out_file):
fin = open(in_file,"r")
fout = open(out_file,"w")
valid = 0
count = fin.readline()
count = int(count)
print("Number of items : ",count)
data = fin.readline()
summary_data = []
while data:
data = data.split()
first = int(data[0])
second = int(data[1])
if ((first > 0) and (first <= count) and (second >
0)):
print("%5d %10d"%(first,second))
fout.write("%5d %10d"%(first,second))
fout.write('\n')
i=0
for d in summary_data:
if d[0]>first:
break
i+=1
summary_data.insert(i, [first, second])
valid += 1
elif (first > count):
print("%5d %10d %s"%(first,second,"invalid item number"))
fout.write("%5d %10d %s"%(first,second,"invalid item
number"))
fout.write('\n')
elif (first <= 0):
print("%5d %10d %s"%(first,second,"invalid item number"))
fout.write("%5d %10d %s"%(first,second,"invalid item
number"))
fout.write('\n')
elif (second <= 0):
print("%5d %10d %s"%(first,second,"invalid quantity"))
fout.write("%5d %10d %s"%(first,second,"invalid quantity"))
fout.write('\n')
data = fin.readline()
fout.write('\n')
fout.write("%s %d"%("Number of valid orders =",valid))
fout.write('\n')
fout.write('\n')
fout.write("Summary:\n") #summary of the valid orders
for d in summary_data:
fout.write("%5d %10d\n"%(d[0],d[1]))
fout.close()
fin.close()
main(in_file,out_file)
Question: I want it to print out the output like below:
----The output file is result-small.txt:
17 254
3 87
48 643
42 387
71 724
3 811
42 80
86 254
0 -107 invalid item number
97 135
86 518
35 91
24 146
82 312
73 348
2 842
3 671
141 878 invalid item number
22 361
45 405
3 580
-2 -224 invalid item number
73 341
52 828
69 662
41 759
53 924
39 175
0 805 invalid item number
-1 127 invalid item number
40 70
178 -652 invalid item number
26 486
38 814
0 -144 invalid item number
61 -610 invalid quantity
72 162
97 711
91 522
14 660
33 520
19 895
91 664
20 776
5 490
72 356
62 290
94 636
80 352
96 606
Number of Valid Orders = 42
Summary:
2 842
3 2149
5 490
14 660
17 254
19 895
20 776
22 361
24 146
26 486
33 520
35 91
38 814
39 175
40 70
41 759
42 467
45 405
48 643
52 828
53 924
62 290
69 662
71 724
72 518
73 689
80 352
82 312
86 772
91 1186
94 636
96 606
97 846
**Note**: Please do it in python as soon as possible**
In: Computer Science
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2, 5, 3, and 5. Their arrival times are 0, 1, 3, 9, 10, and 12. What is the average turnaround time, waiting time, response time, and throughput when using SRJF, RR (q=2), and MLF (q=22i+1). Show your work.
In: Computer Science
1. Processes A, B, C, D, E, and F require service times of 3, 5, 2, 5, 3, and 5. Their arrival times are 0, 1, 3, 9, 10, and 12. What is the average turnaround time, waiting time, response time, and throughput when using SRJF, RR (q=2), and MLF (q=22i+1). Show your work.
In: Computer Science
What is a common attack technique used against ARP to send traffic to wrong destination?
Question 8 options:
ARP timeout |
|
None of these |
|
Static ARP entries |
|
ARP reply |
What is the behavior of the firewall in a situation when there are multiple eligible routing table rules for the packet source and destination?
Question 10 options:
DROP packet |
|
ALLOW packet |
|
Depend on last rule executed |
|
Depends on first rule executed |
List all the open Firewall ports for this IP address 162.241.253.120.
When you try to access services provided at the IP 162.241.253.120 from your host machine, what path do packets from your machine take right before they reach the destination? Please identify and list the IP or Host name of last network hop before final destination?
In: Computer Science
Please answer in C++ Thanks! Use an istream_iterator, the copy algorithm and a back_inserter to read the contents of a text file that contains int values separated by whitespace. Place the int values into a vector of ints. The first argument to the copy algorithm should be the istream_iterator object that's associated with the text file's ifstream object. The second argument should be the istream_iterator object that's initialized using the class template istream_iterator's default constructor-- the resulting object can be used as an "end" iterator. After reading the file's contents, display the contents of the resulting vector.
In: Computer Science
Create in raptor
In this progress report, you will be focusing on setting up accounts for multiple users. You will include defensive programming and error checking to ensure your program functions like an ATM machine would. The account details for your customers are as follows:
Customer UserName Pass Savings Checking
Rober Brown rbrown blue123 2500.00 35.00
Lisa White lwhite Red456 500.00 1250.00
Mark Black mblack Green789 750.00 200.00
For this progress report, update the Progress Report 4 Raptor program to allow one of the above users at a time to safely log in to their account, complete a maximum of 3 transactions, and end the program. Three incorrect attempts at entering the user name and password will end the program. Allow the user to make up to a maximum of 3 transactions at a time. After 3 transactions, the program will terminate. After a transaction is completed, the program will update the running balance and give the customer a detailed description of the transaction. A customer cannot overdraft on their account; if they try to withdraw more money than there is, a warning will be given to the customer. Also note that the ATM doesn’t distribute or collect coins – all monetary values are in whole dollars (e.g. an integer is an acceptable variable type). Any incorrect transaction types will display an appropriate message and count as a transaction.
1 – Deposit (adding money to the account)
2 – Withdrawal (removing money from the account)
3 – Balance Inquiry (check current balance)
4 – Transfer Balance (transfer balance from one account to another)
5 – Log Out (exits/ends the program)
In: Computer Science
You are required to come up with a single header file (IntList.h) that declares and implements the IntNode class (just copy it exactly as it is below) as well as declares the IntList Class interface only. You are also required to come up with a separate implementation file (IntList.cpp) that implements the member functions of the IntList class. While developing your IntList class you must write your own test harness (within a file named main.cpp). Never implement more than 1 or 2 member functions without fulling testing them with your own test harness.
IntNode struct
I am providing the IntNode class you are required to use. Place this class definition within the IntList.h file exactly as is. Make sure you place it above the definition of your IntList class. Notice that you will not code an implementation file for the IntNode class. The IntNode constructor has been defined inline (within the class declaration). Do not write any other functions for the IntNode class. Use as is.
struct IntNode { int data; IntNode *next; IntNode(int data) : data(data), next(0) {} };
IntList class
Encapsulated (Private) Data Fields
head: IntNode *
tail: IntNode *
Public Interface (Public Member Functions)
IntList(): Initializes an empty list.
~IntList(): Deallocates all remaining dynamically allocated memory (all remaining IntNodes).
void display() const: Displays to a single line all of the int values stored in the list, each separated by a space. This function does NOToutput a newline or space at the end.
void push_front(int value): Inserts a data value (within a new node) at the front end of the list.
void pop_front(): Removes the value (actually removes the node that contains the value) at the front end of the list. Does nothing if the list is already empty.
bool empty() const: Returns true if the list does not store any data values (does not have any nodes), otherwise returns false.
main.cpp test harness for lab
Use this main.cpp file for testing your IntList.
#include <iostream> using namespace std; #include "IntList.h" int main() { //tests constructor, destructor, push_front, pop_front, display { cout << "\nlist1 constructor called"; IntList list1; cout << "\npushfront 10"; list1.push_front(10); cout << "\npushfront 20"; list1.push_front(20); cout << "\npushfront 30"; list1.push_front(30); cout << "\nlist1: "; list1.display(); cout << "\npop"; list1.pop_front(); cout << "\nlist1: "; list1.display(); cout << "\npop"; list1.pop_front(); cout << "\nlist1: "; list1.display(); cout << "\npop"; list1.pop_front(); cout << "\nlist1: "; list1.display(); cout << endl; } cout << "list1 destructor called" << endl; return 0; }
In: Computer Science
suggests on how to save the web portfolio
Programming languages Chosen: HTML, CSS, and JavaScript.
Project Name: Auto Portfolio
Project Goal: Create a website that will generate a web portfolio using information inputted by the user.
Product Backlog using user stories: As a user, I want to be able to save my web portfolio in a format which I can save so I can use the website later for my own needs.
In: Computer Science
Using a Python environment of your choice –
Gary = {
"name": "Gary",
"homework": [90.0,97.0,75.0,92.0],
"quizzes": [88.0,40.0,94.0],
"tests": [75.0,90.0]
}
Alice = {
"name": "Alice",
"homework": [100.0, 92.0, 98.0, 100.0],
"quizzes": [82.0, 83.0, 91.0],
"tests": [89.0, 97.0]
}
Tyler = {
"name": "Tyler",
"homework": [0.0, 87.0, 75.0, 22.0],
"quizzes": [0.0, 75.0, 78.0],
"tests": [100.0, 100.0]
}
In: Computer Science
Management Information systems
1. Would you replace a PC with a tablet computer for your studies or work? Why or why not?
2. Try to count how many hours per week you use a personal computer: at your home, in the PC lab, in the library, or elsewhere. Do you consider yourself “computer addicted”?
In: Computer Science
In: Computer Science