Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

CIS 450/ECE 478 Operating Systems Fall 2013 Instructor: Habib M. Ammari Project 1: Design and Development of CPU Allocation Management Software Due...

Hello, I started the project but unable to complete the rest. Here's my code so far. I'm using Visual C++ Professional.#include "Process.h"#pragma oncenamespace My450Project1 {using namespace System;using namespace System::ComponentModel;using namespace System::Collections;using namespace System::Windows::Forms;using namespace System::Data;using namespace System::Drawing;using namespace System::Collections::Generic;/// <summary>/// Summary for Form1/// </summary>public ref class Form1 : public System::Windows::Forms::Form{public:Form1(void){InitializeComponent();////TODO: Add the constructor code here//}protected:/// <summary>/// Clean up any resources being used./// </summary>~Form1(){if (components){delete components;}}private: System::Windows::Forms::Label^ label7;private: System::Windows::Forms::TextBox^ txtQuantum;protected: private: System::Windows::Forms::Label^ label6;private: System::Windows::Forms::Label^ label5;private: System::Windows::Forms::RadioButton^ radRR;private: System::Windows::Forms::Label^ label4;private: System::Windows::Forms::Label^ label3;private: System::Windows::Forms::Label^ label2;private: System::Windows::Forms::Label^ label1;private: System::Windows::Forms::TextBox^ txtID;private: System::Windows::Forms::TextBox^ txtBurstTime;private: System::Windows::Forms::TextBox^ txtPriority;private: System::Windows::Forms::RadioButton^ radSJFPreemption;private: System::Windows::Forms::RadioButton^ radSJF;private: System::Windows::Forms::RadioButton^ radPriorityPreemption;private: System::Windows::Forms::RadioButton^ radPriority;private: System::Windows::Forms::RadioButton^ radFCFS;private: System::Windows::Forms::TextBox^ txtArrivalTime;private: System::Windows::Forms::Button^ bntCalculate;private: System::Windows::Forms::Button^ btnAddProcess;private:/// <summary>/// Required designer variable./// </summary>System::ComponentModel::Container ^components;private: System::Windows::Forms::Button^ btnClear; List<Process> plist;#pragma region Windows Form Designer generated code/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>void InitializeComponent(void){this->label7 = (gcnew System::Windows::Forms::Label());this->txtQuantum = (gcnew System::Windows::Forms::TextBox());this->label6 = (gcnew System::Windows::Forms::Label());this->label5 = (gcnew System::Windows::Forms::Label());this->radRR = (gcnew System::Windows::Forms::RadioButton());this->label4 = (gcnew System::Windows::Forms::Label());this->label3 = (gcnew System::Windows::Forms::Label());this->label2 = (gcnew System::Windows::Forms::Label());this->label1 = (gcnew System::Windows::Forms::Label());this->txtID = (gcnew System::Windows::Forms::TextBox());this->txtBurstTime = (gcnew System::Windows::Forms::TextBox());this->txtPriority = (gcnew System::Windows::Forms::TextBox());this->radSJFPreemption = (gcnew System::Windows::Forms::RadioButton());this->radSJF = (gcnew System::Windows::Forms::RadioButton());this->radPriorityPreemption = (gcnew System::Windows::Forms::RadioButton());this->radPriority = (gcnew System::Windows::Forms::RadioButton());this->radFCFS = (gcnew System::Windows::Forms::RadioButton());this->txtArrivalTime = (gcnew System::Windows::Forms::TextBox());this->bntCalculate = (gcnew System::Windows::Forms::Button());this->btnAddProcess = (gcnew System::Windows::Forms::Button());this->btnClear = (gcnew System::Windows::Forms::Button());this->SuspendLayout();// // label7// this->label7->AutoSize = true;this->label7->Location = System::Drawing::Point(109, 282);this->label7->Name = L"label7";this->label7->Size = System::Drawing::Size(53, 13);this->label7->TabIndex = 34;this->label7->Text = L"Quantum:";// // txtQuantum// this->txtQuantum->Location = System::Drawing::Point(168, 279);this->txtQuantum->Name = L"txtQuantum";this->txtQuantum->Size = System::Drawing::Size(54, 20);this->txtQuantum->TabIndex = 33;// // label6// this->label6->AutoSize = true;this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));this->label6->Location = System::Drawing::Point(4, -49);this->label6->Name = L"label6";this->label6->Size = System::Drawing::Size(97, 25);this->label6->TabIndex = 32;this->label6->Text = L"Project 1";this->label6->TextAlign = System::Drawing::ContentAlignment::TopCenter;// // label5// this->label5->AutoSize = true;this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));this->label5->Location = System::Drawing::Point(4, -74);this->label5->Name = L"label5";this->label5->Size = System::Drawing::Size(276, 25);this->label5->TabIndex = 31;this->label5->Text = L"CIS 450 Operating Systems";this->label5->TextAlign = System::Drawing::ContentAlignment::TopCenter;// // radRR// this->radRR->AutoSize = true;this->radRR->Location = System::Drawing::Point(89, 262);this->radRR->Name = L"radRR";this->radRR->Size = System::Drawing::Size(88, 17);this->radRR->TabIndex = 30;this->radRR->TabStop = true;this->radRR->Text = L"Round-Robin";this->radRR->UseVisualStyleBackColor = true;// // label4// this->label4->AutoSize = true;this->label4->Location = System::Drawing::Point(6, 95);this->label4->Name = L"label4";this->label4->Size = System::Drawing::Size(65, 13);this->label4->TabIndex = 27;this->label4->Text = L"Arrival Time:";// // label3// this->label3->AutoSize = true;this->label3->Location = System::Drawing::Point(30, 69);this->label3->Name = L"label3";this->label3->Size = System::Drawing::Size(41, 13);this->label3->TabIndex = 26;this->label3->Text = L"Priority:";// // label2// this->label2->AutoSize = true;this->label2->Location = System::Drawing::Point(11, 43);this->label2->Name = L"label2";this->label2->Size = System::Drawing::Size(60, 13);this->label2->TabIndex = 29;this->label2->Text = L"Burst Time:";// // label1// this->label1->AutoSize = true;this->label1->Location = System::Drawing::Point(50, 17);this->label1->Name = L"label1";this->label1->Size = System::Drawing::Size(21, 13);this->label1->TabIndex = 28;this->label1->Text = L"ID:";// // txtID// this->txtID->Location = System::Drawing::Point(74, 14);this->txtID->Name = L"txtID";this->txtID->Size = System::Drawing::Size(100, 20);this->txtID->TabIndex = 25;// // txtBurstTime// this->txtBurstTime->Location = System::Drawing::Point(74, 40);this->txtBurstTime->Name = L"txtBurstTime";this->txtBurstTime->Size = System::Drawing::Size(100, 20);this->txtBurstTime->TabIndex = 23;// // txtPriority// this->txtPriority->Location = System::Drawing::Point(74, 66);this->txtPriority->Name = L"txtPriority";this->txtPriority->Size = System::Drawing::Size(100, 20);this->txtPriority->TabIndex = 24;// // radSJFPreemption// this->radSJFPreemption->AutoSize = true;this->radSJFPreemption->Location = System::Drawing::Point(89, 239);this->radSJFPreemption->Name = L"radSJFPreemption";this->radSJFPreemption->Size = System::Drawing::Size(190, 17);this->radSJFPreemption->TabIndex = 22;this->radSJFPreemption->TabStop = true;this->radSJFPreemption->Text = L"Shhortest-Job-First with Preemption";this->radSJFPreemption->UseVisualStyleBackColor = true;// // radSJF// this->radSJF->AutoSize = true;this->radSJF->Location = System::Drawing::Point(89, 216);this->radSJF->Name = L"radSJF";this->radSJF->Size = System::Drawing::Size(106, 17);this->radSJF->TabIndex = 21;this->radSJF->TabStop = true;this->radSJF->Text = L"Shortest-Job-First";this->radSJF->UseVisualStyleBackColor = true;this->radSJF->CheckedChanged += gcnew System::EventHandler(this, &Form1::radSJF_CheckedChanged);// // radPriorityPreemption// this->radPriorityPreemption->AutoSize = true;this->radPriorityPreemption->Location = System::Drawing::Point(89, 193);this->radPriorityPreemption->Name = L"radPriorityPreemption";this->radPriorityPreemption->Size = System::Drawing::Size(134, 17);this->radPriorityPreemption->TabIndex = 20;this->radPriorityPreemption->TabStop = true;this->radPriorityPreemption->Text = L"Priority with Preemption";this->radPriorityPreemption->UseVisualStyleBackColor = true;// // radPriority// this->radPriority->AutoSize = true;this->radPriority->Location = System::Drawing::Point(89, 170);this->radPriority->Name = L"radPriority";this->radPriority->Size = System::Drawing::Size(56, 17);this->radPriority->TabIndex = 19;this->radPriority->TabStop = true;this->radPriority->Text = L"Priority";this->radPriority->UseVisualStyleBackColor = true;this->radPriority->CheckedChanged += gcnew System::EventHandler(this, &Form1::radPriority_CheckedChanged);// // radFCFS// this->radFCFS->AutoSize = true;this->radFCFS->Checked = true;this->radFCFS->Location = System::Drawing::Point(89, 147);this->radFCFS->Name = L"radFCFS";this->radFCFS->Size = System::Drawing::Size(133, 17);this->radFCFS->TabIndex = 18;this->radFCFS->TabStop = true;this->radFCFS->Text = L"First-Come-First-Served";this->radFCFS->UseVisualStyleBackColor = true;// // txtArrivalTime// this->txtArrivalTime->Location = System::Drawing::Point(74, 92);this->txtArrivalTime->Name = L"txtArrivalTime";this->txtArrivalTime->Size = System::Drawing::Size(100, 20);this->txtArrivalTime->TabIndex = 17;// // bntCalculate// this->bntCalculate->Location = System::Drawing::Point(89, 314);this->bntCalculate->Name = L"bntCalculate";this->bntCalculate->Size = System::Drawing::Size(75, 23);this->bntCalculate->TabIndex = 16;this->bntCalculate->Text = L"Execute";this->bntCalculate->UseVisualStyleBackColor = true;this->bntCalculate->Click += gcnew System::EventHandler(this, &Form1::bntCalculate_Click);// // btnAddProcess// this->btnAddProcess->Location = System::Drawing::Point(89, 118);this->btnAddProcess->Name = L"btnAddProcess";this->btnAddProcess->Size = System::Drawing::Size(75, 23);this->btnAddProcess->TabIndex = 15;this->btnAddProcess->Text = L"Add Process";this->btnAddProcess->UseVisualStyleBackColor = true;this->btnAddProcess->Click += gcnew System::EventHandler(this, &Form1::btnAddProcess_Click);// // btnClear// this->btnClear->Location = System::Drawing::Point(327, 360);this->btnClear->Name = L"btnClear";this->btnClear->Size = System::Drawing::Size(75, 23);this->btnClear->TabIndex = 36;this->btnClear->Text = L"Clear";this->btnClear->UseVisualStyleBackColor = true;this->btnClear->Click += gcnew System::EventHandler(this, &Form1::btnClear_Click);// // Form1// this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;this->ClientSize = System::Drawing::Size(721, 395);this->Controls->Add(this->btnClear);this->Controls->Add(this->label7);this->Controls->Add(this->txtQuantum);this->Controls->Add(this->label6);this->Controls->Add(this->label5);this->Controls->Add(this->radRR);this->Controls->Add(this->label4);this->Controls->Add(this->label3);this->Controls->Add(this->label2);this->Controls->Add(this->label1);this->Controls->Add(this->txtID);this->Controls->Add(this->txtBurstTime);this->Controls->Add(this->txtPriority);this->Controls->Add(this->radSJFPreemption);this->Controls->Add(this->radSJF);this->Controls->Add(this->radPriorityPreemption);this->Controls->Add(this->radPriority);this->Controls->Add(this->radFCFS);this->Controls->Add(this->txtArrivalTime);this->Controls->Add(this->bntCalculate);this->Controls->Add(this->btnAddProcess);this->Name = L"Form1";this->Text = L"Form1";this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);this->ResumeLayout(false);this->PerformLayout();}#pragma endregionpublic: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { }private: System::Void btnAddProcess_Click(System::Object^ sender, System::EventArgs^ e) { Process p; //(int id, int burstTime, int priority, int arrivalTime) p.setValues(Convert::ToInt32(txtID->Text), Convert::ToInt32(txtBurstTime->Text), Convert::ToInt32(txtPriority->Text), Convert::ToInt32(txtArrivalTime->Text)); plist.Add(p); //Clear Text Boxes txtID->Text = ""; txtBurstTime->Text = ""; txtPriority->Text = ""; txtArrivalTime->Text = ""; }private: System::Void bntCalculate_Click(System::Object^ sender, System::EventArgs^ e) { if(radFCFS->Checked==true) sortFCFS(); //Done else if (radPriority->Checked==true) sortPriority(); //Done //else if (radPriorityPreemption->Checked==true) //sortPriorityPreemption(); else if (radSJF->Checked==true) sortSJF(); //Done //else if (radSJFPreemption->Checked==true) //sortSJFPreemption(); //else if (radRR->Checked==true) //sortRR(); GenerateGnattChart(); }public: System::Void sortFCFS() {Process temp;for (int passes = 0; passes < plist.Count - 1; passes++){for (int j = 0; j < plist.Count - passes - 1; j++){if (plist[j].Proc_ArrivalTime > plist[j+1].Proc_ArrivalTime){temp = plist[j];plist[j] = plist[j+1];plist[j+1]=temp;}}}}public: System::Void sortSJF() {Process temp;for (int passes = 0; passes < plist.Count - 1; passes++){for (int j = 0; j < plist.Count - passes - 1; j++){if (plist[j].Proc_BurstTime > plist[j+1].Proc_BurstTime){temp = plist[j];plist[j] = plist[j+1];plist[j+1]=temp;}}}}public: System::Void sortPriority() {Process temp;for (int passes = 0; passes < plist.Count - 1; passes++){for (int j = 0; j < plist.Count - passes - 1; j++){if (plist[j].Proc_Priority > plist[j+1].Proc_Priority){temp = plist[j];plist[j] = plist[j+1];plist[j+1]=temp;}}}}void DrawRectangle(int i)//http://msdn.microsoft.com/en-us/library{int RectangleOffset=32;System::Drawing::Pen^ myPen =gcnew System::Drawing::Pen(System::Drawing::Color::Red);System::Drawing::Graphics^ formGraphics;formGraphics = this->CreateGraphics();formGraphics->DrawRectangle(myPen, Rectangle(400+(i*RectangleOffset), 16, 32, 32)); //Rectangle(x,y,width,height)delete myPen;delete formGraphics;} void DrawProcess(int i)//http://msdn.microsoft.com/en-us/library{int RectangleOffset=32;System::Drawing::Graphics^ formGraphics = this->CreateGraphics();String^ drawString = plist[i].Proc_Id.ToString();System::Drawing::Font^ drawFont =gcnew System::Drawing::Font("Arial", 16);System::Drawing::SolidBrush^ drawBrush = gcnewSystem::Drawing::SolidBrush(System::Drawing::Color::Black);System::Drawing::StringFormat^ drawFormat =gcnew System::Drawing::StringFormat();formGraphics->DrawString(drawString, drawFont, drawBrush, 400+(i*RectangleOffset), 16, drawFormat);delete drawFont;delete drawBrush;delete formGraphics;}void GenerateGnattChart(){for(int i=0; i<plist.Count;i++){DrawRectangle(i);DrawProcess(i);}}private: System::Void On_paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) { }private: System::Void pnlOutput_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) { }private: System::Void btnClear_Click(System::Object^ sender, System::EventArgs^ e) { Application::Restart(); }private: System::Void radSJF_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { }private: System::Void radPriority_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { }};}Here's the process.h fileusing namespace System::Collections::Generic;value class Process{public:int Proc_Id, Proc_BurstTime, Proc_Priority, Proc_ArrivalTime;void setValues(int id, int burstTime, int priority, int arrivalTime) {Proc_Id = id;Proc_BurstTime = burstTime;Proc_Priority = priority;Proc_ArrivalTime = arrivalTime;}};

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question