Browse Source

Commit #11. Erste Berechnungsfunktionen für das Gesammtergebnis erstellt.

master
MSeibert97 6 years ago
parent
commit
c638ef7355
  1. 56
      .idea/workspace.xml
  2. 87
      src/FitnessTest_M.java

56
.idea/workspace.xml

@ -32,14 +32,18 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/FitnessTest_M.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="126" column="42" selection-start-line="126" selection-start-column="42" selection-end-line="126" selection-end-column="42" />
<state relative-caret-position="556">
<caret line="304" lean-forward="true" selection-start-line="304" selection-end-line="304" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5244#5245#0" expanded="true" />
<element signature="e#5297#5298#0" expanded="true" />
<element signature="e#5356#5357#0" expanded="true" />
<element signature="e#5411#5412#0" expanded="true" />
<element signature="e#2063#2525#0" expanded="true" />
<element signature="e#2524#2525#0" expanded="true" />
<element signature="e#2877#3340#0" expanded="true" />
<element signature="e#3339#3340#0" expanded="true" />
<element signature="e#11696#11697#0" expanded="true" />
<element signature="e#11749#11750#0" expanded="true" />
<element signature="e#11808#11809#0" expanded="true" />
<element signature="e#11863#11864#0" expanded="true" />
</folding>
</state>
</provider>
@ -48,7 +52,7 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/FitnessTest_M_Test.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<state relative-caret-position="425">
<caret line="93" column="31" selection-start-line="93" selection-start-column="31" selection-end-line="93" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
@ -491,7 +495,21 @@
<option name="project" value="LOCAL" />
<updated>1563278597504</updated>
</task>
<option name="localTasksCounter" value="32" />
<task id="LOCAL-00032" summary="Commit #10. Bestätigungsbuttons eingefügt.">
<created>1563281180742</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1563281180742</updated>
</task>
<task id="LOCAL-00033" summary="Commit #11. Erste Berechnungsfunktionen für das Gesammtergebnis erstellt.">
<created>1563283451442</created>
<option name="number" value="00033" />
<option name="presentableId" value="LOCAL-00033" />
<option name="project" value="LOCAL" />
<updated>1563283451442</updated>
</task>
<option name="localTasksCounter" value="34" />
<servers />
</component>
<component name="TestHistory">
@ -606,7 +624,9 @@
<MESSAGE value="Der siebte Commit. Weitere Testfälle." />
<MESSAGE value="Der achte Commit. Neue Fitnessfragen sollen entworfen&#10;werden. Die Fragen (Labels) wurden erstellt und&#10;positioniert." />
<MESSAGE value="Der neunte Commit. Textfelder zu den Fragen wurden eingefügt" />
<option name="LAST_COMMIT_MESSAGE" value="Der neunte Commit. Textfelder zu den Fragen wurden eingefügt" />
<MESSAGE value="Commit #10. Bestätigungsbuttons eingefügt." />
<MESSAGE value="Commit #11. Erste Berechnungsfunktionen für das Gesammtergebnis erstellt." />
<option name="LAST_COMMIT_MESSAGE" value="Commit #11. Erste Berechnungsfunktionen für das Gesammtergebnis erstellt." />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/Alpha_GOGS$Main.ic" NAME="Main Coverage Results" MODIFIED="1563229577210" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
@ -699,7 +719,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/FitnessTest_M_Test.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<state relative-caret-position="425">
<caret line="93" column="31" selection-start-line="93" selection-start-column="31" selection-end-line="93" selection-end-column="31" />
<folding>
<element signature="imports" expanded="true" />
@ -711,14 +731,18 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/FitnessTest_M.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="126" column="42" selection-start-line="126" selection-start-column="42" selection-end-line="126" selection-end-column="42" />
<state relative-caret-position="556">
<caret line="304" lean-forward="true" selection-start-line="304" selection-end-line="304" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#5244#5245#0" expanded="true" />
<element signature="e#5297#5298#0" expanded="true" />
<element signature="e#5356#5357#0" expanded="true" />
<element signature="e#5411#5412#0" expanded="true" />
<element signature="e#2063#2525#0" expanded="true" />
<element signature="e#2524#2525#0" expanded="true" />
<element signature="e#2877#3340#0" expanded="true" />
<element signature="e#3339#3340#0" expanded="true" />
<element signature="e#11696#11697#0" expanded="true" />
<element signature="e#11749#11750#0" expanded="true" />
<element signature="e#11808#11809#0" expanded="true" />
<element signature="e#11863#11864#0" expanded="true" />
</folding>
</state>
</provider>

87
src/FitnessTest_M.java

@ -32,8 +32,13 @@ public class FitnessTest_M extends JFrame {
JButton question2_confirm = null;
JButton question3_confirm = null;
JButton question4_confirm = null;
JButton totalscore_submit = null;
int points = 0;
int points1;
int points2;
int points3;
int points4;
int points5;
public FitnessTest_M() {
@ -126,13 +131,13 @@ public class FitnessTest_M extends JFrame {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == question1_confirm) {
if(question_tf1.getText().startsWith("A") || question_tf1.getText().startsWith("a")) {
points += 10;
points1 = 10;
}
if(question_tf1.getText().startsWith("B") || question_tf1.getText().startsWith("b")) {
points += 5;
points1 = 5;
}
if(question_tf1.getText().startsWith("C") || question_tf1.getText().startsWith("c")) {
points += 0;
points1 = 0;
}
}
}
@ -144,13 +149,13 @@ public class FitnessTest_M extends JFrame {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == question2_confirm) {
if(question_tf2.getText().startsWith("A") || question_tf2.getText().startsWith("a")) {
points += 10;
points2 = 10;
}
if(question_tf2.getText().startsWith("B") || question_tf2.getText().startsWith("b")) {
points += 5;
points2 = 5;
}
if(question_tf2.getText().startsWith("C") || question_tf2.getText().startsWith("c")) {
points += 0;
points2 = 0;
}
}
}
@ -162,13 +167,13 @@ public class FitnessTest_M extends JFrame {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == question3_confirm) {
if(question_tf3.getText().startsWith("A") || question_tf3.getText().startsWith("a")) {
points += 0;
points3 = 0;
}
if(question_tf3.getText().startsWith("B") || question_tf3.getText().startsWith("b")) {
points += 4;
points3 = 4;
}
if(question_tf3.getText().startsWith("C") || question_tf3.getText().startsWith("c")) {
points += 10;
points3 = 10;
}
}
}
@ -180,13 +185,13 @@ public class FitnessTest_M extends JFrame {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == question4_confirm) {
if(question_tf4.getText().startsWith("A") || question_tf4.getText().startsWith("a")) {
points += 0;
points4 = 0;
}
if(question_tf4.getText().startsWith("B") || question_tf4.getText().startsWith("b")) {
points += 4;
points4 = 4;
}
if(question_tf4.getText().startsWith("C") || question_tf4.getText().startsWith("c")) {
points += 10;
points4 = 10;
}
}
}
@ -256,26 +261,26 @@ public class FitnessTest_M extends JFrame {
float height = Float.parseFloat(height_tf.getText());
float weight = Float.parseFloat(weight_tf.getText());
int bmi = calculateBmi(height, weight);
if(bmi <= 15) points += 0;
if(bmi == 16) points += 1;
if(bmi == 17) points += 2;
if(bmi == 18) points += 3;
if(bmi == 19) points += 6;
if(bmi == 20) points += 8;
if(bmi == 21) points += 9;
if(bmi == 22) points += 10;
if(bmi == 23) points += 10;
if(bmi == 24) points += 9;
if(bmi == 25) points += 8;
if(bmi == 26) points += 7;
if(bmi == 27) points += 6;
if(bmi == 28) points += 5;
if(bmi == 29) points += 4;
if(bmi == 30) points += 4;
if(bmi == 31) points += 3;
if(bmi == 32) points += 2;
if(bmi == 33) points += 1;
if(bmi >= 34) points += 0;
if(bmi <= 15) points5 = 0;
if(bmi == 16) points5 = 1;
if(bmi == 17) points5 = 2;
if(bmi == 18) points5 = 3;
if(bmi == 19) points5 = 6;
if(bmi == 20) points5 = 8;
if(bmi == 21) points5 = 9;
if(bmi == 22) points5 = 10;
if(bmi == 23) points5 = 10;
if(bmi == 24) points5 = 9;
if(bmi == 25) points5 = 8;
if(bmi == 26) points5 = 7;
if(bmi == 27) points5 = 6;
if(bmi == 28) points5 = 5;
if(bmi == 29) points5 = 4;
if(bmi == 30) points5 = 4;
if(bmi == 31) points5 = 3;
if(bmi == 32) points5 = 2;
if(bmi == 33) points5 = 1;
if(bmi >= 34) points5 = 0;
}
}
});
@ -284,6 +289,22 @@ public class FitnessTest_M extends JFrame {
frame.add(bmi_rechnen);
frame.add(bmi_confirm);
totalscore_submit = new JButton("Gesammtergebnis");
totalscore_submit.setBounds(1100, 200, 200, 150);
totalscore_submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(e.getSource() == totalscore_submit) {
float sum = (points1+points2+points3+points4+points5)/5;
JOptionPane.showMessageDialog(null,
"Ihre Gesammtfitnesspunktzahl betraegt:\n" + sum,
"Testergebnis",
JOptionPane.WARNING_MESSAGE);
}
}
});
frame.add(totalscore_submit);
frame.setVisible(true);
}

Loading…
Cancel
Save