I have to code in c++, and I’m given these files
project 2.cc
/*
* Copyright (C) Mohsen Zohrevandi, 2017
*
* Do not share this file with anyone
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main (int argc, char* argv[])
{
int task;
if (argc < 2)
{
cout << “Error: missing argumentn”;
return 1;
}
/*
Note that by convention argv[0] is the name of your executable,
and the first argument to your program is stored in argv[1]
*/
task = atoi(argv[1]);
// TODO: Read the input grammar at this point from standard input
/*
Hint: You can modify and use the lexer from previous project
to read the input. Note that there are only 4 token types needed
for reading the input in this project.
WARNING: You will need to modify lexer.cc and lexer.h to only
support the tokens needed for this project if you are going to
use the lexer.
*/
switch (task) {
case 1:
cout << “decl idList idList1 colon ID COMMA n”;
break;
case 2:
// TODO: perform task 2.
break;
case 3:
// TODO: perform task 3.
break;
case 4:
// TODO: perform task 4.
break;
case 5:
// TODO: perform task 5.
break;
default:
cout << “Error: unrecognized task number ” << task << “n”;
break;
}
return 0;
}
———————————————————————————————–
lexer.h
#ifndef __LEXER__H__
#define __LEXER__H__
#include <vector>
#include <string>
#include “inputbuf.h”
// Lexer modified for FIRST & FOLLOW project
typedef enum { END_OF_FILE = 0, ARROW, HASH, DOUBLEHASH, ID, ERROR } TokenType;
class Token {
public:
void Print();
std::string lexeme;
TokenType token_type;
int line_no;
};
class LexicalAnalyzer {
public:
Token GetToken();
TokenType UngetToken(Token);
LexicalAnalyzer();
private:
std::vector<Token> tokens;
int line_no;
Token tmp;
InputBuffer input;
bool SkipSpace();
Token ScanId();
};
#endif //__LEXER__H__
———————————————————————————————–
lexer.cc
#include <iostream>
#include <istream>
#include <vector>
#include <string>
#include <cctype>
#include “lexer.h”
#include “inputbuf.h”
using namespace std;
// Lexer modified for FIRST & FOLLOW project
string reserved[] = { “END_OF_FILE”, “ARROW”, “HASH”, “DOUBLEHASH”, “ID”, “ERROR” };
void Token::Print()
{
cout << “{” << this->lexeme << ” , “
<< reserved[(int) this->token_type] << ” , “
<< this->line_no << “}n”;
}
LexicalAnalyzer::LexicalAnalyzer()
{
this->line_no = 1;
tmp.lexeme = “”;
tmp.line_no = 1;
tmp.token_type = ERROR;
}
bool LexicalAnalyzer::SkipSpace()
{
char c;
bool space_encountered = false;
input.GetChar(c);
line_no += (c == ‘n’);
while (!input.EndOfInput() && isspace(c)) {
space_encountered = true;
input.GetChar(c);
line_no += (c == ‘n’);
}
if (!input.EndOfInput()) {
input.UngetChar(c);
}
return space_encountered;
}
Token LexicalAnalyzer::ScanId()
{
char c;
input.GetChar(c);
if (isalpha(c)) {
tmp.lexeme = “”;
while (!input.EndOfInput() && isalnum(c)) {
tmp.lexeme += c;
input.GetChar(c);
}
if (!input.EndOfInput()) {
input.UngetChar(c);
}
tmp.line_no = line_no;
tmp.token_type = ID;
} else {
if (!input.EndOfInput()) {
input.UngetChar(c);
}
tmp.lexeme = “”;
tmp.token_type = ERROR;
}
return tmp;
}
// you should unget tokens in the reverse order in which they
// are obtained. If you execute
//
// t1 = lexer.GetToken();
// t2 = lexer.GetToken();
// t3 = lexer.GetToken();
//
// in this order, you should execute
//
// lexer.UngetToken(t3);
// lexer.UngetToken(t2);
// lexer.UngetToken(t1);
//
// if you want to unget all three tokens. Note that it does not
// make sense to unget t1 without first ungetting t2 and t3
//
TokenType LexicalAnalyzer::UngetToken(Token tok)
{
tokens.push_back(tok);;
return tok.token_type;
}
Token LexicalAnalyzer::GetToken()
{
char c;
// if there are tokens that were previously
// stored due to UngetToken(), pop a token and
// return it without reading from input
if (!tokens.empty()) {
tmp = tokens.back();
tokens.pop_back();
return tmp;
}
SkipSpace();
tmp.lexeme = “”;
tmp.line_no = line_no;
input.GetChar(c);
switch (c) {
case ‘-‘:
input.GetChar(c);
if (c == ‘>’) {
tmp.token_type = ARROW;
} else {
if (!input.EndOfInput()) {
input.UngetChar(c);
}
tmp.token_type = ERROR;
}
return tmp;
case ‘#’:
input.GetChar(c);
if (c == ‘#’) {
tmp.token_type = DOUBLEHASH;
} else {
if (!input.EndOfInput()) {
input.UngetChar(c);
}
tmp.token_type = HASH;
}
return tmp;
default:
if (isalpha(c)) {
input.UngetChar(c);
return ScanId();
} else if (input.EndOfInput())
tmp.token_type = END_OF_FILE;
else
tmp.token_type = ERROR;
return tmp;
}
}
———————————————————————————————–
inputbuf.h
#ifndef __INPUT_BUFFER__H__
#define __INPUT_BUFFER__H__
#include <string>
class InputBuffer {
public:
void GetChar(char&);
char UngetChar(char);
std::string UngetString(std::string);
bool EndOfInput();
private:
std::vector<char> input_buffer;
};
#endif //__INPUT_BUFFER__H__
———————————————————————————————–
inputbuffer.cc
#include <iostream>
#include <istream>
#include <vector>
#include <string>
#include <cstdio>
#include “inputbuf.h”
using namespace std;
bool InputBuffer::EndOfInput()
{
if (!input_buffer.empty())
return false;
else
return cin.eof();
}
char InputBuffer::UngetChar(char c)
{
if (c != EOF)
input_buffer.push_back(c);;
return c;
}
void InputBuffer::GetChar(char& c)
{
if (!input_buffer.empty()) {
c = input_buffer.back();
input_buffer.pop_back();
} else {
cin.get(c);
}
}
string InputBuffer::UngetString(string s)
{
for (unsigned i = 0; i < s.size(); i++)
input_buffer.push_back(s[s.size()-i-1]);
return s;
}
———————————————————————-
Please help. I have no clue at the moment,
Im only asking for case 1.
I can figure out the rest.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Analyze My Organization And Provide Measures Of Effectiveness And Effi
/in Uncategorized /by developerI have to analyze my organization and provide measures of effectiveness and efficiencies that are used in our operation. Why did I select these measures and are they the proper ones to measure my organization. How would I know? Also I have to provide information as to whether the measures of efficiency or effectiveness
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Calculate The Estimated Costs Of What The Utility Expenses Will Be At
/in Uncategorized /by developerI have to calculate the estimated costs of what the utility expenses will be at 10,800 labor hours using regression The first column is the hour and the second column is the costs (current) but i have to predict the costs for the 10,800??525
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Calculate The Following Using The Data Presented In The Picture
/in Uncategorized /by developerI have to calculate the following using the data presented in the picture:
6) Overhead product yield
7) Overall Column efficiency
8) Murphree efficiency
9) Heating and cooling requirements (how much steam and cooling water were required for
the operation, kg/h?)
The process can be done using excel but i need to know which equations are being used
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Code In C And I M Given These Files Project 2
/in Uncategorized /by developerI have to code in c++, and I’m given these files
project 2.cc
/*
* Copyright (C) Mohsen Zohrevandi, 2017
*
* Do not share this file with anyone
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main (int argc, char* argv[])
{
int task;
if (argc < 2)
{
cout << “Error: missing argumentn”;
return 1;
}
/*
Note that by convention argv[0] is the name of your executable,
and the first argument to your program is stored in argv[1]
*/
task = atoi(argv[1]);
// TODO: Read the input grammar at this point from standard input
/*
Hint: You can modify and use the lexer from previous project
to read the input. Note that there are only 4 token types needed
for reading the input in this project.
WARNING: You will need to modify lexer.cc and lexer.h to only
support the tokens needed for this project if you are going to
use the lexer.
*/
switch (task) {
case 1:
cout << “decl idList idList1 colon ID COMMA n”;
break;
case 2:
// TODO: perform task 2.
break;
case 3:
// TODO: perform task 3.
break;
case 4:
// TODO: perform task 4.
break;
case 5:
// TODO: perform task 5.
break;
default:
cout << “Error: unrecognized task number ” << task << “n”;
break;
}
return 0;
}
———————————————————————————————–
lexer.h
#ifndef __LEXER__H__
#define __LEXER__H__
#include <vector>
#include <string>
#include “inputbuf.h”
// Lexer modified for FIRST & FOLLOW project
typedef enum { END_OF_FILE = 0, ARROW, HASH, DOUBLEHASH, ID, ERROR } TokenType;
class Token {
public:
void Print();
std::string lexeme;
TokenType token_type;
int line_no;
};
class LexicalAnalyzer {
public:
Token GetToken();
TokenType UngetToken(Token);
LexicalAnalyzer();
private:
std::vector<Token> tokens;
int line_no;
Token tmp;
InputBuffer input;
bool SkipSpace();
Token ScanId();
};
#endif //__LEXER__H__
———————————————————————————————–
lexer.cc
#include <iostream>
#include <istream>
#include <vector>
#include <string>
#include <cctype>
#include “lexer.h”
#include “inputbuf.h”
using namespace std;
// Lexer modified for FIRST & FOLLOW project
string reserved[] = { “END_OF_FILE”, “ARROW”, “HASH”, “DOUBLEHASH”, “ID”, “ERROR” };
void Token::Print()
{
cout << “{” << this->lexeme << ” , “
<< reserved[(int) this->token_type] << ” , “
<< this->line_no << “}n”;
}
LexicalAnalyzer::LexicalAnalyzer()
{
this->line_no = 1;
tmp.lexeme = “”;
tmp.line_no = 1;
tmp.token_type = ERROR;
}
bool LexicalAnalyzer::SkipSpace()
{
char c;
bool space_encountered = false;
input.GetChar(c);
line_no += (c == ‘n’);
while (!input.EndOfInput() && isspace(c)) {
space_encountered = true;
input.GetChar(c);
line_no += (c == ‘n’);
}
if (!input.EndOfInput()) {
input.UngetChar(c);
}
return space_encountered;
}
Token LexicalAnalyzer::ScanId()
{
char c;
input.GetChar(c);
if (isalpha(c)) {
tmp.lexeme = “”;
while (!input.EndOfInput() && isalnum(c)) {
tmp.lexeme += c;
input.GetChar(c);
}
if (!input.EndOfInput()) {
input.UngetChar(c);
}
tmp.line_no = line_no;
tmp.token_type = ID;
} else {
if (!input.EndOfInput()) {
input.UngetChar(c);
}
tmp.lexeme = “”;
tmp.token_type = ERROR;
}
return tmp;
}
// you should unget tokens in the reverse order in which they
// are obtained. If you execute
//
// t1 = lexer.GetToken();
// t2 = lexer.GetToken();
// t3 = lexer.GetToken();
//
// in this order, you should execute
//
// lexer.UngetToken(t3);
// lexer.UngetToken(t2);
// lexer.UngetToken(t1);
//
// if you want to unget all three tokens. Note that it does not
// make sense to unget t1 without first ungetting t2 and t3
//
TokenType LexicalAnalyzer::UngetToken(Token tok)
{
tokens.push_back(tok);;
return tok.token_type;
}
Token LexicalAnalyzer::GetToken()
{
char c;
// if there are tokens that were previously
// stored due to UngetToken(), pop a token and
// return it without reading from input
if (!tokens.empty()) {
tmp = tokens.back();
tokens.pop_back();
return tmp;
}
SkipSpace();
tmp.lexeme = “”;
tmp.line_no = line_no;
input.GetChar(c);
switch (c) {
case ‘-‘:
input.GetChar(c);
if (c == ‘>’) {
tmp.token_type = ARROW;
} else {
if (!input.EndOfInput()) {
input.UngetChar(c);
}
tmp.token_type = ERROR;
}
return tmp;
case ‘#’:
input.GetChar(c);
if (c == ‘#’) {
tmp.token_type = DOUBLEHASH;
} else {
if (!input.EndOfInput()) {
input.UngetChar(c);
}
tmp.token_type = HASH;
}
return tmp;
default:
if (isalpha(c)) {
input.UngetChar(c);
return ScanId();
} else if (input.EndOfInput())
tmp.token_type = END_OF_FILE;
else
tmp.token_type = ERROR;
return tmp;
}
}
———————————————————————————————–
inputbuf.h
#ifndef __INPUT_BUFFER__H__
#define __INPUT_BUFFER__H__
#include <string>
class InputBuffer {
public:
void GetChar(char&);
char UngetChar(char);
std::string UngetString(std::string);
bool EndOfInput();
private:
std::vector<char> input_buffer;
};
#endif //__INPUT_BUFFER__H__
———————————————————————————————–
inputbuffer.cc
#include <iostream>
#include <istream>
#include <vector>
#include <string>
#include <cstdio>
#include “inputbuf.h”
using namespace std;
bool InputBuffer::EndOfInput()
{
if (!input_buffer.empty())
return false;
else
return cin.eof();
}
char InputBuffer::UngetChar(char c)
{
if (c != EOF)
input_buffer.push_back(c);;
return c;
}
void InputBuffer::GetChar(char& c)
{
if (!input_buffer.empty()) {
c = input_buffer.back();
input_buffer.pop_back();
} else {
cin.get(c);
}
}
string InputBuffer::UngetString(string s)
{
for (unsigned i = 0; i < s.size(); i++)
input_buffer.push_back(s[s.size()-i-1]);
return s;
}
———————————————————————-
Please help. I have no clue at the moment,
Im only asking for case 1.
I can figure out the rest.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Come Up With 4 Icd 10 Pcs Codes For This Particular Question And I Hav
/in Uncategorized /by developerI have to come up with 4 ICD-10-PCS codes for this particular question and I have no idea. Here’s the question:
Percutaneous exchange of transvenous right atrial and ventricular leads of a pacemaker, which was initially placed three years ago; battery remains intact. No EP studies performed at this time.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Complete This Program So That It Assigns And Prints Letter Grades By R
/in Uncategorized /by developerI have to complete this program so that it assigns and prints letter grades by ranges (in addition to the percentage): A 90-100B 80-89.99C 70-79.99D 60-69.99F < 60Also how many students fall into each category.—————————————————————// Median Grades Calculation// #include <string>#include <vector>#include <algorithm>#include <iostream>#include <iomanip>#include <stdexcept>// using directivesusing std::vector;using std::cout;using std::streamsize;using std::endl;using std::max;using std::domain_error;///////////////////////////////////////////////////////////////////////////////// hold all information related to a single studentstruct student_info{// students name// midterm and final exam gradesvector<double> homework; // all homework grades};///////////////////////////////////////////////////////////////////////////////// compute the median of a vector<double>// note: calling this function copies the whole vectordouble median(vector<double> vec){typedef vector<double>::size_type vec_sz;vec_sz size = vec.size();if (size == 0)throw domain_error(“vector is empty, median undefined”);sort(vec.begin(), vec.end());vec_sz mid = size / 2;return size % 2 == 0 ? (vec[mid] + vec[mid-1]) / 2 : vec[mid];}///////////////////////////////////////////////////////////////////////////////// compute a student’s overall grade from midterm and final exam // grades and homework gradedouble grade(double midterm, double final, double homework){return 0.2 * midterm + 0.4 * final + 0.4 * homework;}// Compute a student’s overall grade from midterm and// final exam grades and all homework grades.// This function does not copy the vector argument // (as median does so for us).double grade(double midterm, double final, vector<double> const& hw){if (hw.size() == 0)throw domain_error(“student has done no homework”);return grade(midterm, final, median(hw));}// Calculate the final grade for one studentdouble grade(student_info const& s){return grade(s.midterm, s.final, s.homework);}///////////////////////////////////////////////////////////////////////////////// read homework grades from an input stream// into a vector<double>istream& read_hw(istream& in, vector<double>& hw){if (in) {// get rid of previous contents// read homework gradesdouble x;while (cin >> x) hw.push_back(x);// clear the stream so that input will work for// the next studentin.clear();}return in;}// read all information related to one studentistream& read(istream& in, student_info& s){// read the students name, midterm and final exam gradesin >> s.name >> s.midterm >> s.final;// read all homework grades for this studentreturn read_hw(in, s.homework);}///////////////////////////////////////////////////////////////////////////////// compare two student_info instances, return whether ‘x’// is smaller than ‘y’ based on comparing the stored names// of the studentsbool compare(student_info const& x, student_info const& y){return x.name < y.name;}///////////////////////////////////////////////////////////////////////////////int main(){// all student records// length of longest name // read and store all the records, find the length of // the longest namestudent_info record;while (read(cin, record)) {maxlen = max(maxlen, record.name.size());students.push_back(record);}// alphabetize the recordssort(students.begin(), students.end(), compare);for (vector<student_info>::size_type i = 0; i != students.size(); ++i) {// write the name, padded on the right side to maxlen + 1 characterscout << students[i].name << string(maxlen + 1 – students[i].name.size(), ‘ ‘); // compute and write the gradetry {double final_grade = grade(students[i]);streamsize prec = cout.precision();cout << setprecision(3) << final_grade << setprecision(prec);} catch (domain_error e) {cout << e.what();}cout << endl;}return 0;}
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Compose Page Length Paper About The Following Topic Globalization I
/in Uncategorized /by developercan someone do homework please !!!
I have to compose page length paper about the following :
Topic – Globalization
I learned that how culture is preserved- as through language and values. Its my turn to reveal how my culture is being kept alive in my country. How rightfully preserve cultural identity through food traditions and values perhaps some other aspects.
also reflect and express how cultural traditions have changed in region due to globalization – we can use comparison from parents and grandparents generation
also Cite resources.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Conduct An Audit On Valley Publishing Newsprint I Do Not Know How To B
/in Uncategorized /by developerI have to conduct an audit on valley publishing newSprint. i DO NOT KNOW HOW TO BERGIN. I just kn ow the steps involved but do not know to perform they. (1) Audit the inventory of newsprint C-1 C2.(2) Audit the newsprint consumption. Audit the publication sales
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Create A 5 Channel Linear Tdm Pcm Transmitter Receiver In Multisim Her
/in Uncategorized /by developerI have to create a 5 channel linear TDM-PCM transmitter / receiver in MultiSim. Here are the steps listed
in the assignment –
The first step in implementation of the PCM-TDM receiver is to separate the code words of the various combined signals. For this reason, you need one Serial-to-Parallel converter.
IC 74164 is an 8-bit serial input-parallel output shift register that works opposite to IC 74165. Each separated 8-bit code word at the output of 74164 belongs to one user.
These code words then must be converted to analog samples. This process is done in analog-to-digital converter (DAC). You need to take one generic 8-bit DAC.
The analog samples of different users must be separated in a round robin fashion. 4017 IC or any similar ring counter is a good mean to do so. So, the output of DAC should be connected to all inputs of 5 analog channels, when each switch is closed only for a portion of time as it polls the relevant signal. You may use 4066 or 4016 ICs as analog switch.
The last step is to reconstruct the original signal. You should use low pass filters for this reason.
I have the transmitter completed, i need help putting it all together.
MSMCompressedElectronicsWorkbenchXMLq#######p#####ɦ`k#hp$xpm0teP7+f##8 ##1H ]f(ںY #!0I}# #p~…
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
I Have To Create A Report
/in Uncategorized /by developerName:Date:KNOWNSAMPLEHCINaOHNaz504NazCO3ABNO:Mg (NO:)2Sr(NO:)2ResultswithHCINaOHNaz504 NazCO3UNKNOWNCreate a report form so that all pertinent data can be conveniently written down by filling in the blank form at the time of the experiment. Thisreport form should be typed out on a computer using Office software such as MS Word or Excel Include a space on the first page to writecalculations for the amounts of Mg(NO:)2 and Sr( NO:)2 to be weighed out (See Prelab item #2 below). Remember, some data is numerical innature (i.e. masses of solids that are used, etc.), while other data is descriptive (i.e. observations of reactions). All pertinent data should have aplace to be filled in on the report form. but it should be organized with the spaces to include data neatly laid out and large enough to write theexpected results without having to cram your handwriting. A table/grid similar to the one on the first page of this experiment may be useful forsummarizing reaction observations. However, there will be additional numerical data that will probably need its own blanks. Think through theprocedure thoroughly to be sure you have included all necessary blanks.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"