100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS assignment 2 $7.06   Add to cart

Other

COS assignment 2

1 review
 253 views  18 purchases
  • Course
  • Institution

COS assignment 2 solutions with source code and link to the zipped file of the solution at the end of the file change the code wisely. The link is working when not opening ask for help

Preview 3 out of 25  pages

  • July 6, 2023
  • 25
  • 2022/2023
  • Other
  • Unknown

1  review

review-writer-avatar

By: hiltontutorials • 1 year ago

waste of money those codes not running and link not accessible for the zipped files

reply-writer-avatar

By: CrystalIndigo • 1 year ago

If you did everything right your applications should run and also link should open, because the code and link have been tested by a lot of people and no complaints. If you need assistance contact on whatsapp for help

avatar-seller
COS3711 2023 ASSIGNMENT 2
SOLUTION
THERE IS A LINK TO THE ZIPPED FILE AT THE END OF THIS DOCUMENT



Crystal Indigo!
Crystal Indigo!
Providing all solutions you need anytime
+27 76 626 8187




**NOTE: if the GUI is displaying differently from what you desire just change
how the widgets are displayed. copy the code and run DO necessary
changes.

,//QUESTION 1
//output




//TextCounter.h
#ifndef TEXTCOUNTER_H
#define TEXTCOUNTER_H

#include <QObject>
#include <QString>
#include <QVector>
class TextCounter : public QObject
{
Q_OBJECT
public:
explicit TextCounter(QObject *parent = nullptr);
void processArguments(int argc, char *argv[]);

private:
bool flagA;
bool flagB;
bool flagC;
bool flagD;

void countOccurrences(const QString &filename);
void printResults(int wordCount, int hyphenatedCount, int
sameCharacterCount, int nonVowelStartCount);
QString removePunctuation(const QString &text) const;
bool isWordLongerThan4CharsStartingWithCapital(const QString &word);
bool isHyphenatedWord(const QString &word);
bool isSameCharacterWord(const QString &word);
bool doesNotStartWithVowel(const QString &word);



};

#endif // TEXTCOUNTER_H



//TextCounter.cpp
#include "textcounter.h"
#include <QDebug>

, #include <QFile>
#include <QTextStream>
#include <QRegularExpression>

TextCounter::TextCounter(QObject *parent) : QObject(parent),
flagA(false), flagB(false), flagC(false), flagD(false)
{
}

void TextCounter::processArguments(int argc, char *argv[])
{
// If no arguments provided, print a message
if (argc == 1) {
qDebug() << "No arguments provided. Please include file name(s).";
return;
}

// Parse the arguments
QVector<QString> filenames;
for (int i = 1; i < argc; ++i) {
QString arg = QString::fromUtf8(argv[i]);
if (arg.startsWith('-')) {
if (arg.contains('a'))
flagA = true;
if (arg.contains('b'))
flagB = true;
if (arg.contains('c'))
flagC = true;
if (arg.contains('d'))
flagD = true;
} else {
filenames.append(arg);
}
}

// If no flags provided, assume all flags were used
if (!flagA && !flagB && !flagC && !flagD) {
flagA = true;
flagB = true;
flagC = true;
flagD = true;
}

// Process each file
for (const QString &filename : filenames) {
countOccurrences(filename);
}
}

void TextCounter::countOccurrences(const QString &filename)
{

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 CrystalIndigo. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

82191 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
$7.06  18x  sold
  • (1)
  Add to cart