The program is best made in java Answer only if you know the answer. and it shou
ID: 3755318 • Letter: T
Question
The program is best made in javaAnswer only if you know the answer. and it should be working
Using your favorite programming language do the following: 1) Implement DFA as a menu-based or GUI program 2) Allow the user to configure the DFA interactively and using a config txt file 3) The configuration consists of: {Q, q0, F, S, d) 4) The DFA continuously allows the user to enter an input string via keyboard or a list of strings in a txt file 5) The DFA scans the input string and generates a "ACCEPT" or "REJECT"
Explanation / Answer
Answer:
Message.h
main.cpp
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstring>
using namespace std;
#include "BBoard.h"
#include "User.h"
#include "Message.h"
#include "Reply.h"
#include "Topic.h"
/*int main(int argc, char* argv[])
{
string file = argv[argc - 1];
// Message m;
// m.display();
// cout << endl;
// Message m1("Zafir", "Great Subject", "THis is the body!!");
// m1.display();
BBoard board;
board.setup(file);
board.login();
return 0;
}*/
int main(int argc, char **argv)
{
// check commandline arguments
// if (argc != 3){
// cout << "ERROR: Invalid program call." << endl
// << "Usage: <program_name> userfile datafile" << endl;
//return 1;
//}
string userfile("users1.txt");
string datafile("data.txt");
BBoard bb("Bulletin Board");
// load users from file
if (!bb.load_users(userfile))
{
cout << "ERROR: Cannot load users from " << userfile << endl;
return 1;
}
// load messages
if (!bb.load_messages(datafile))
{
cout << "ERROR: Cannot load messages from " << datafile << endl;
return 1;
}
bb.login();
//bool a = bb.save_messages("out.txt");
//a=a;
bb.run();
// save messages
if (!bb.save_messages(datafile))
{
cout << "ERROR: Cannot save messages to " << datafile << endl;
return 1;
}
// cout << "saved" << endl;
return 0;
}
BBoard.cpp
#include "BBoard.h"
#include "Reply.h"
#include "Topic.h"
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
using namespace std;
BBoard::BBoard(){
current_user=NULL;
}
BBoard::BBoard(const string &ttl){
title=ttl;
current_user = NULL;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.