Drama, Film, and Mass Communication homework help
Drama, Film, and Mass Communication homework help. 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;///
public ref class Form1 : public System::Windows::Forms::Form{public:Form1(void){InitializeComponent();////TODO: Add the constructor code here//}protected:///
~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:///
System::ComponentModel::Container ^components;private: System::Windows::Forms::Button^ btnClear; List
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
iority 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