Finish GUI
This commit is contained in:
parent
c7ba2b9275
commit
58b0264394
|
@ -36,6 +36,7 @@ HEADERS += \
|
|||
src/gui/trianglePerimeterWindow.h \
|
||||
src/methods/circle/circle.h \
|
||||
src/methods/equ_triangle/equ_triangle.h \
|
||||
src/methods/triangle/triangle.h \
|
||||
src/methods/parallelogram/parallelogram.h \
|
||||
src/methods/rectangle/rectangle.h \
|
||||
src/methods/square/square.h \
|
||||
|
@ -60,9 +61,12 @@ SOURCES += \
|
|||
src/methods/equ_triangle/area.cpp \
|
||||
src/methods/equ_triangle/height.cpp \
|
||||
src/methods/equ_triangle/perimeter.cpp \
|
||||
src/methods/triangle/area.cpp \
|
||||
src/methods/triangle/perimeter.cpp \
|
||||
src/methods/parallelogram/area.cpp \
|
||||
src/methods/parallelogram/perimeter.cpp \
|
||||
src/methods/rectangle/area.cpp \
|
||||
src/methods/rectangle/perimeter.cpp \
|
||||
src/methods/square/area.cpp \
|
||||
src/methods/square/perimeter.cpp
|
||||
src/methods/square/perimeter.cpp \
|
||||
src/gui/equTrianPerimeterwindow.cpp
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd bin
|
||||
|
||||
./circletest
|
||||
./equTriantest
|
||||
./parallelTest
|
||||
./rectangleTest
|
||||
./squareTest
|
||||
./triangleTest
|
||||
|
||||
cd ..
|
|
@ -0,0 +1,31 @@
|
|||
#include "circleAreaWindow.h"
|
||||
|
||||
CircleAreaWin::CircleAreaWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
areaText->setValidator(new QDoubleValidator());
|
||||
radiusText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void CircleAreaWin::on_calculateBtn_clicked() {
|
||||
if (areaText->text().toStdString() == "" ||
|
||||
radiusText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto area = float{std::stof(areaText->text().toStdString())};
|
||||
auto radius = float{std::stof(radiusText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = circle_calc_area(me, radius, area);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_CIRCLEAREAWINDOW_H
|
||||
#define BOUNDS_CIRCLEAREAWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_circle_area.h"
|
||||
#include <circle/circle.h>
|
||||
|
||||
namespace Ui {
|
||||
class circleArea;
|
||||
}
|
||||
|
||||
class CircleAreaWin : public QDialog, private Ui::circleArea {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CircleAreaWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,34 @@
|
|||
#include "circlePerimeterWindow.h"
|
||||
|
||||
CirclePerimeterWin::CirclePerimeterWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
perimeterText->setValidator(new QDoubleValidator());
|
||||
radiusText->setValidator(new QDoubleValidator());
|
||||
diameterText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void CirclePerimeterWin::on_calculateBtn_clicked() {
|
||||
if (perimeterText->text().toStdString() == "" ||
|
||||
radiusText->text().toStdString() == "" ||
|
||||
diameterText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto perimeter = float{std::stof(perimeterText->text().toStdString())};
|
||||
auto radius = float{std::stof(radiusText->text().toStdString())};
|
||||
auto diameter = float{std::stof(diameterText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = circle_calc_perimeter(me, radius, diameter, perimeter);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_CIRCLEPERIMETERWINDOW_H
|
||||
#define BOUNDS_CIRCLEPERIMETERWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_circle_perimeter.h"
|
||||
#include <circle/circle.h>
|
||||
|
||||
namespace Ui {
|
||||
class circlePerimeter;
|
||||
}
|
||||
|
||||
class CirclePerimeterWin : public QDialog, private Ui::circlePerimeter {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CirclePerimeterWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -33,7 +33,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<widget class="QLineEdit" name="areaText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
|
@ -47,7 +47,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="lineEdit_2">
|
||||
<widget class="QLineEdit" name="radiusText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
|
@ -61,14 +61,14 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_3">
|
||||
<widget class="QLineEdit" name="maxErrorText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="calculateBtn">
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
|
@ -77,7 +77,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<widget class="QTextEdit" name="plainTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<widget class="QLineEdit" name="perimeterText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
|
@ -50,7 +50,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="lineEdit_2">
|
||||
<widget class="QLineEdit" name="radiusText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
|
@ -64,7 +64,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_4">
|
||||
<widget class="QLineEdit" name="maxErrorText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
|
@ -78,14 +78,14 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="lineEdit_3">
|
||||
<widget class="QLineEdit" name="diameterText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="calculateBtn">
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#include "equTrianAreaWindow.h"
|
||||
|
||||
EquTrianAreaWin::EquTrianAreaWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
areaText->setValidator(new QDoubleValidator());
|
||||
sideText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void EquTrianAreaWin::on_calculateBtn_clicked() {
|
||||
if (areaText->text().toStdString() == "" ||
|
||||
sideText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto area = float{std::stof(areaText->text().toStdString())};
|
||||
auto side = float{std::stof(sideText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = etrian_calc_area(me, side, area);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_EQUTRIANAREAWINDOW_H
|
||||
#define BOUNDS_EQUTRIANAREAWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_equ_trian_area.h"
|
||||
#include <equ_triangle/equ_triangle.h>
|
||||
|
||||
namespace Ui {
|
||||
class equTrianArea;
|
||||
}
|
||||
|
||||
class EquTrianAreaWin : public QDialog, private Ui::equTrianArea {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EquTrianAreaWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_EQUTRIANPERIMETERWINDOW_H
|
||||
#define BOUNDS_EQUTRIANPERIMETERWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_equ_trian_perimeter.h"
|
||||
#include <equ_triangle/equ_triangle.h>
|
||||
|
||||
namespace Ui {
|
||||
class equTrianPerimeter;
|
||||
}
|
||||
|
||||
class EquTrianPerimeterWin : public QDialog, private Ui::equTrianPerimeter {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EquTrianPerimeterWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,31 @@
|
|||
#include "equTrianPerimeterWindow.h"
|
||||
|
||||
EquTrianPerimeterWin::EquTrianPerimeterWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
perimeterText->setValidator(new QDoubleValidator());
|
||||
sideText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void EquTrianPerimeterWin::on_calculateBtn_clicked() {
|
||||
if (perimeterText->text().toStdString() == "" ||
|
||||
sideText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto perimeter = float{std::stof(perimeterText->text().toStdString())};
|
||||
auto side = float{std::stof(sideText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = etrian_calc_perimeter(me, side, perimeter);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<widget class="QLineEdit" name="perimeterText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
|
@ -47,7 +47,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="lineEdit_2">
|
||||
<widget class="QLineEdit" name="sideText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="calculateBtn">
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
|
|
|
@ -6,7 +6,54 @@ MainWin::MainWin(QWidget* parent)
|
|||
}
|
||||
|
||||
void MainWin::on_selectBtn_clicked() {
|
||||
SquareAreaWin* win = new SquareAreaWin();
|
||||
win->show();
|
||||
hide();
|
||||
QString sval = formulaBox->currentText();
|
||||
if (sval == "Square Formula: Area") {
|
||||
SquareAreaWin *win = new SquareAreaWin(this);
|
||||
connect(win, SIGNAL(destroyed()), win, SLOT(show()));
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Square Formula: Perimeter") {
|
||||
SquarePerimeterWin *win = new SquarePerimeterWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Rectangle Formula: Area") {
|
||||
RectangleAreaWin *win = new RectangleAreaWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Rectangle Formula: Perimeter") {
|
||||
RectanglePerimeterWin *win = new RectanglePerimeterWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Triangle Formula: Area") {
|
||||
TrianAreaWin *win = new TrianAreaWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Triangle Formula: Perimeter") {
|
||||
TrianPerimeterWin *win = new TrianPerimeterWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Equilateral Triangle Formula: Area") {
|
||||
EquTrianAreaWin *win = new EquTrianAreaWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Equilateral Triangle Formula: Perimeter") {
|
||||
EquTrianPerimeterWin *win = new EquTrianPerimeterWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Parallelogram Formula: Area") {
|
||||
ParallelogramAreaWin *win = new ParallelogramAreaWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Parallelogram Formula: Perimeter") {
|
||||
ParallelogramPerimeterWin *win = new ParallelogramPerimeterWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Circle Formula: Area") {
|
||||
CircleAreaWin *win = new CircleAreaWin(this);
|
||||
win->open();
|
||||
}
|
||||
else if (sval == "Circle Formula: Perimeter") {
|
||||
CirclePerimeterWin *win = new CirclePerimeterWin(this);
|
||||
win->open();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,19 @@
|
|||
#include <QMessageBox>
|
||||
|
||||
#include "ui_mainWindow.h"
|
||||
|
||||
#include "squareAreaWindow.h"
|
||||
#include "squarePerimeterWindow.h"
|
||||
#include "rectangleAreaWindow.h"
|
||||
#include "rectanglePerimeterWindow.h"
|
||||
#include "triangleAreaWindow.h"
|
||||
#include "trianglePerimeterWindow.h"
|
||||
#include "equTrianAreaWindow.h"
|
||||
#include "equTrianPerimeterWindow.h"
|
||||
#include "parallelogramAreaWindow.h"
|
||||
#include "parallelogramPerimeterWindow.h"
|
||||
#include "circleAreaWindow.h"
|
||||
#include "circlePerimeterWindow.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
|
|
|
@ -6,168 +6,176 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>508</width>
|
||||
<height>406</height>
|
||||
<width>492</width>
|
||||
<height>408</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Upper-Lower Bounds</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>60</y>
|
||||
<width>111</width>
|
||||
<height>71</height>
|
||||
<x>90</x>
|
||||
<y>40</y>
|
||||
<width>300</width>
|
||||
<height>315</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>28</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Upper</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>100</y>
|
||||
<width>111</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>28</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lower</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>140</y>
|
||||
<width>131</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>28</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bounds</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="formulaBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>220</y>
|
||||
<width>151</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Square Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Square Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Rectangle Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Rectangle Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Triangle Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Triangle Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Equilateral Triangle Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Equilateral Triangle Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Parallelogram Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Parallelogram Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Circle Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Circle Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="selectBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>250</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>281</width>
|
||||
<height>251</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>281</width>
|
||||
<height>251</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>80</y>
|
||||
<width>104</width>
|
||||
<height>42</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>28</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Upper</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>120</y>
|
||||
<width>104</width>
|
||||
<height>42</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>28</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lower</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>160</y>
|
||||
<width>127</width>
|
||||
<height>42</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>28</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bounds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="formulaBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Square Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Square Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Rectangle Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Rectangle Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Triangle Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Triangle Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Equilateral Triangle Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Equilateral Triangle Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Parallelogram Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Parallelogram Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Circle Formula: Area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Circle Formula: Perimeter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="selectBtn">
|
||||
<property name="text">
|
||||
<string>Select</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>508</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#include "parallelogramAreaWindow.h"
|
||||
|
||||
ParallelogramAreaWin::ParallelogramAreaWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
areaText->setValidator(new QDoubleValidator());
|
||||
heightText->setValidator(new QDoubleValidator());
|
||||
baseText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void ParallelogramAreaWin::on_calculateBtn_clicked() {
|
||||
if (areaText->text().toStdString() == "" ||
|
||||
heightText->text().toStdString() == "" ||
|
||||
baseText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto area = float{std::stof(areaText->text().toStdString())};
|
||||
auto base = float{std::stof(baseText->text().toStdString())};
|
||||
auto height = float{std::stof(heightText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = parall_calc_area(me, base, height, area);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_PARALLELOGRAMAREAWINDOW_H
|
||||
#define BOUNDS_PARALLELOGRAMAREAWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_parallelogram_area.h"
|
||||
#include <parallelogram/parallelogram.h>
|
||||
|
||||
namespace Ui {
|
||||
class parallelogramArea;
|
||||
}
|
||||
|
||||
class ParallelogramAreaWin : public QDialog, private Ui::parallelogramArea {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ParallelogramAreaWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,34 @@
|
|||
#include "parallelogramPerimeterWindow.h"
|
||||
|
||||
ParallelogramPerimeterWin::ParallelogramPerimeterWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
perimeterText->setValidator(new QDoubleValidator());
|
||||
heightText->setValidator(new QDoubleValidator());
|
||||
baseText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void ParallelogramPerimeterWin::on_calculateBtn_clicked() {
|
||||
if (perimeterText->text().toStdString() == "" ||
|
||||
heightText->text().toStdString() == "" ||
|
||||
baseText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto perimeter = float{std::stof(perimeterText->text().toStdString())};
|
||||
auto base = float{std::stof(baseText->text().toStdString())};
|
||||
auto height = float{std::stof(heightText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = parall_calc_perimeter(me, base, height, perimeter);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_PARALLELOGRAMPERIMETERWINDOW_H
|
||||
#define BOUNDS_PARALLELOGRAMPERIMETERWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_parallelogram_perimeter.h"
|
||||
#include <parallelogram/parallelogram.h>
|
||||
|
||||
namespace Ui {
|
||||
class parallelogramPerimeter;
|
||||
}
|
||||
|
||||
class ParallelogramPerimeterWin : public QDialog, private Ui::parallelogramPerimeter {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ParallelogramPerimeterWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -82,7 +82,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="QPushButton" name="calculateText">
|
||||
<widget class="QPushButton" name="calculateBtn">
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#include "rectangleAreaWindow.h"
|
||||
|
||||
RectangleAreaWin::RectangleAreaWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
areaText->setValidator(new QDoubleValidator());
|
||||
lengthText->setValidator(new QDoubleValidator());
|
||||
widthText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void RectangleAreaWin::on_calculateBtn_clicked() {
|
||||
if (areaText->text().toStdString() == "" ||
|
||||
lengthText->text().toStdString() == "" ||
|
||||
widthText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto area = float{std::stof(areaText->text().toStdString())};
|
||||
auto length = float{std::stof(lengthText->text().toStdString())};
|
||||
auto width = float{std::stof(widthText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = rect_calc_area(me, width, length, area);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_RECTANGLEAREAWINDOW_H
|
||||
#define BOUNDS_RECTANGLEAREAWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_rectangle_area.h"
|
||||
#include <rectangle/rectangle.h>
|
||||
|
||||
namespace Ui {
|
||||
class rectangleArea;
|
||||
}
|
||||
|
||||
class RectangleAreaWin : public QDialog, private Ui::rectangleArea {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RectangleAreaWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,34 @@
|
|||
#include "rectanglePerimeterWindow.h"
|
||||
|
||||
RectanglePerimeterWin::RectanglePerimeterWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
perimeterText->setValidator(new QDoubleValidator());
|
||||
lengthText->setValidator(new QDoubleValidator());
|
||||
widthText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void RectanglePerimeterWin::on_calculateBtn_clicked() {
|
||||
if (perimeterText->text().toStdString() == "" ||
|
||||
lengthText->text().toStdString() == "" ||
|
||||
widthText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto perimeter = float{std::stof(perimeterText->text().toStdString())};
|
||||
auto length = float{std::stof(lengthText->text().toStdString())};
|
||||
auto width = float{std::stof(widthText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = rect_calc_perimeter(me, width, length, perimeter);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_RECTANGLEPERIMETERWINDOW_H
|
||||
#define BOUNDS_RECTANGLEPERIMETERWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_rectangle_perimeter.h"
|
||||
#include <rectangle/rectangle.h>
|
||||
|
||||
namespace Ui {
|
||||
class rectanglePerimeter;
|
||||
}
|
||||
|
||||
class RectanglePerimeterWin : public QDialog, private Ui::rectanglePerimeter {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RectanglePerimeterWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -13,7 +13,7 @@
|
|||
<property name="windowTitle">
|
||||
<string>Rectangle Formula: Perimeter</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>-2</x>
|
||||
|
@ -33,7 +33,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="perimeterText"/>
|
||||
<widget class="QLineEdit" name="perimeterText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
|
@ -43,7 +47,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="lengthText"/>
|
||||
<widget class="QLineEdit" name="lengthText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
|
@ -53,7 +61,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="perimeterText_2"/>
|
||||
<widget class="QLineEdit" name="maxErrorText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
|
@ -63,7 +75,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="widthText"/>
|
||||
<widget class="QLineEdit" name="widthText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="QPushButton" name="calculateBtn">
|
||||
|
|
|
@ -25,7 +25,7 @@ void TrianAreaWin::on_calculateBtn_clicked() {
|
|||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res =
|
||||
res = trian_calc_area(me, area, base, height);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_triangle_area.h"
|
||||
#include <triangle
|
||||
#include <triangle/triangle.h>
|
||||
|
||||
namespace Ui {
|
||||
class triangleArea;
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#include "trianglePerimeterWindow.h"
|
||||
|
||||
TrianPerimeterWin::TrianPerimeterWin(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setupUi(this);
|
||||
perimeterText->setValidator(new QDoubleValidator());
|
||||
sideAText->setValidator(new QDoubleValidator());
|
||||
sideBText->setValidator(new QDoubleValidator());
|
||||
sideCText->setValidator(new QDoubleValidator());
|
||||
maxErrorText->setValidator(new QDoubleValidator());
|
||||
}
|
||||
|
||||
void TrianPerimeterWin::on_calculateBtn_clicked() {
|
||||
if (perimeterText->text().toStdString() == "" ||
|
||||
sideAText->text().toStdString() == "" ||
|
||||
sideBText->text().toStdString() == "" ||
|
||||
sideCText->text().toStdString() == "" ||
|
||||
maxErrorText->text().toStdString() == "") {
|
||||
plainTextEdit->setPlainText(QString::fromStdString("Nothing computes to nothing.\nFill the blanks!"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto perimeter = float{std::stof(perimeterText->text().toStdString())};
|
||||
auto a = float{std::stof(sideAText->text().toStdString())};
|
||||
auto b = float{std::stof(sideBText->text().toStdString())};
|
||||
auto c = float{std::stof(sideCText->text().toStdString())};
|
||||
auto me = float{std::stof(maxErrorText->text().toStdString())};
|
||||
uplowBounds res;
|
||||
|
||||
try {
|
||||
res = trian_calc_perimeter(me, perimeter, a, b, c);
|
||||
plainTextEdit->setPlainText(QString::fromStdString(std::string("UB: ") + std::to_string(res.s_upper) + std::string("\nLB: ") + std::to_string(res.s_lower)));
|
||||
} catch (std::invalid_argument& error) {
|
||||
plainTextEdit->setPlainText(QString::fromStdString(error.what()));
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef BOUNDS_TRIANGLEPERIMETERWINDOW_H
|
||||
#define BOUNDS_TRIANGLEPERIMETERWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
#include "ui_triangle_perimeter.h"
|
||||
#include <triangle/triangle.h>
|
||||
|
||||
namespace Ui {
|
||||
class trianglePerimeter;
|
||||
}
|
||||
|
||||
class TrianPerimeterWin : public QDialog, private Ui::trianglePerimeter {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TrianPerimeterWin(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_calculateBtn_clicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -6,69 +6,103 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>354</width>
|
||||
<height>263</height>
|
||||
<width>404</width>
|
||||
<height>298</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Triangle Formula: Area</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>2</x>
|
||||
<y>4</y>
|
||||
<width>41</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Area:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>346</width>
|
||||
<height>252</height>
|
||||
<y>4</y>
|
||||
<width>399</width>
|
||||
<height>289</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Area:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="areaText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Height:</string>
|
||||
<string>Side A:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="heightText">
|
||||
<item row="0" column="4">
|
||||
<widget class="QLineEdit" name="sideAText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Side C:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="sideCText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Side B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLineEdit" name="sideBText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="maxErrorText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3" colspan="2">
|
||||
<widget class="QPushButton" name="calculateBtn">
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
<string>ME:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="baseText">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="perimeterText">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
|
@ -76,7 +110,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -13,7 +13,7 @@ auto etrian_calc_area(float me, float s, float a)->uplowBounds {
|
|||
answer.s_upper = sqrt((4/sqrt(3)*(a+me)));
|
||||
return answer;
|
||||
}
|
||||
else if (a == 0.0f && s == 0.0f)
|
||||
else if (a != 0.0f && s != 0.0f)
|
||||
throw std::invalid_argument("Everythign is given, you should probably reconsider your life descisions.");
|
||||
else if (a == 0.0f && s == 0.0f)
|
||||
throw std::invalid_argument("Nothing computes to nothing.");
|
||||
|
|
|
@ -4,13 +4,13 @@ auto sqr_calc_perimeter(float me, float s, float p)->uplowBounds {
|
|||
auto answer = uplowBounds();
|
||||
|
||||
if (p == 0.0f && s != 0.0f) {
|
||||
answer.s_lower = 4*(s-me);
|
||||
answer.s_upper = 4*(s+me);
|
||||
answer.s_lower = 4.0f*(s-me);
|
||||
answer.s_upper = 4.0f*(s+me);
|
||||
return answer;
|
||||
}
|
||||
else if (p != 0.0f && s == 0.0f) {
|
||||
answer.s_lower = (s-me)/4;
|
||||
answer.s_upper = (s+me)/4;
|
||||
answer.s_lower = (p-me)/4.0f;
|
||||
answer.s_upper = (p+me)/4.0f;
|
||||
return answer;
|
||||
}
|
||||
else if (p != 0.0f && s != 0.0f)
|
||||
|
|
|
@ -18,3 +18,19 @@ TEST_CASE("sqr_calc_area: if area is given") {
|
|||
REQUIRE(Approx(sqr_calc_area(0.05f, 0.0f, 10.0f).s_upper).epsilon(.01) == (3.17f));
|
||||
}
|
||||
|
||||
TEST_CASE("sqr_calc_perimeter: if side is given") {
|
||||
REQUIRE(Approx(sqr_calc_perimeter(0.5f, 5.0f, 0.0f).s_lower).epsilon(1) == (18.0f));
|
||||
REQUIRE(Approx(sqr_calc_perimeter(0.5f, 5.0f, 0.0f).s_upper).epsilon(1) == (22.0f));
|
||||
|
||||
REQUIRE(Approx(sqr_calc_perimeter(0.05f, 5.0f, 0.0f).s_lower).epsilon(.1) == (19.8f));
|
||||
REQUIRE(Approx(sqr_calc_perimeter(0.05f, 5.0f, 0.0f).s_upper).epsilon(.1) == (20.2f));
|
||||
}
|
||||
|
||||
TEST_CASE("sqr_calc_perimeter: if perimeter is given") {
|
||||
REQUIRE(Approx(sqr_calc_perimeter(0.5f, 0.0f, 5.0f).s_lower).epsilon(.001) == (1.125f));
|
||||
REQUIRE(Approx(sqr_calc_perimeter(0.5f, 0.0f, 5.0f).s_upper).epsilon(.001) == (1.375f));
|
||||
|
||||
REQUIRE(Approx(sqr_calc_perimeter(0.05f, 0.0f, 5.0f).s_lower).epsilon(.0001) == (1.2375f));
|
||||
REQUIRE(Approx(sqr_calc_perimeter(0.05f, 0.0f, 5.0f).s_upper).epsilon(.0001) == (1.2625f));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue