100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS3711 Assignment 2 2023 $11.10
Add to cart

Exam (elaborations)

COS3711 Assignment 2 2023

3 reviews
 299 views  19 purchases
  • Course
  • Institution

COS assignment 2 solutions with source code and link to the zipped file. Use the document as a reference do not submit it as it is. All the code is running with no errors. Write a console application that can be run from the command line using the following forms: count // run without any param...

[Show more]
Last document update: 1 year ago

Preview 3 out of 20  pages

  • July 7, 2023
  • July 10, 2023
  • 20
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers

3  reviews

review-writer-avatar

By: StudyApex • 1 year ago

Q2 GUI different from assignment.

review-writer-avatar

By: happystudymate • 1 year ago

Buggy Code !!

review-writer-avatar

By: darkanarchist • 1 year ago

the CMAKE links dont actually contain CMAKE code but just identical code to the QMake link. This code is very outdated and now wrong, cos3711 has not used QRegExp for several years and qt6 (which is what cos3711 has used for 3 years) no longer supports it, this is definetly not a 2023 assignment but just an older assignment. Very unsatisfied.

reply-writer-avatar

By: MyAssignments • 1 year ago

Good day, CMake link has been updated. The code is not wrong just using Qt5 that's why at the end of the document it clearly states that it's for educational purposes. The other link is now showing the CMake file sorry about that. Please next time at least notify us on our contact details if you have any other issues with the link.

reply-writer-avatar

By: darkanarchist • 1 year ago

I did try to phone first and it went straight to voicemail :/ thank you for fixing it though.

avatar-seller
For Assistance with other modules
Call or Whatsapp +27682021794
www.myassignments.co.za




COS3711
Assignment 02
2023

Due date
20 July 2023 ,
11:00 PM
Unique Number:732808


There is a link to download the zipped file at the end of the
document.Please DO NOT submit that zipped file as it is, use
it as reference to correct your code and see what needs to be
done. All programs are running correctly with the instruction
on the questions, no errors when building the code, check the
images.

,QUESTION 1
// COUNT.H
#ifndef COUNT_H
#define COUNT_H

#include <QStringList>

class Count
{
public:
Count();
Count(QStringList args);
QString doCount();
private:
bool aFlag, bFlag, cFlag, dFlag;
QStringList filenames;
QString processFile(QString f);
QString process(char flag, QString contents);
};

#endif // COUNT_H


// COUNT.CPP
#include "count.h"
#include <QRegularExpression>
#include <QFile>
#include <QTextStream>

Count::Count()
{
aFlag = false;
bFlag = false;
cFlag = false;
dFlag = false;
}

Count::Count(QStringList args)
{
aFlag = false;
bFlag = false;
cFlag = false;
dFlag = false;

foreach (QString s, args)
{
if (s.at(0) == '-')
{
s.remove(0, 1); //remove -
while (s.length()>0)
{
switch (s.at(0).toLatin1())
{
case 'a': aFlag = true; break;
case 'b': bFlag = true; break;
case 'c': cFlag = true; break;
case 'd': dFlag = true;
}
s.remove(0, 1);
}

, }
else
filenames.append(s);
}

if (!aFlag && !bFlag && !cFlag && !dFlag) // no flags passed
{
aFlag = true;
bFlag = true;
cFlag = true;
dFlag = true;
}
}

QString Count::doCount()
{
QString result;
if (filenames.size() > 0)
{
foreach (QString filename, filenames)
{
result.append(processFile(filename));
result.append("\n");
}
}
else
result = QString("No files to process");
return result;
}

QString Count::processFile(QString f)
{
QString result;

QFile file(f);
if (!file.open(QIODevice::ReadOnly))
{
result = QString("%1 did not open sucessfully").arg(f);
}
else
{
QTextStream in(&file);
QString contents = in.readAll();
file.close();

result.append(QString("***" + f + "***\n"));
QString str = contents.trimmed();
QRegExp rem("[.,?!;:]");
str.remove(rem);

if (aFlag) result.append(process('a', str));
if (bFlag) result.append(process('b', str));
if (cFlag) result.append(process('c', str));
if (dFlag) result.append(process('d', str));
}

return result;
}

QString Count::process(char flag, QString contents)
{

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller MyAssignments. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $11.10. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

53068 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$11.10  19x  sold
  • (3)
Add to cart
Added