Take multiple inputs from single edit text and add those values? [on hold]
$begingroup$
I am creating a CGPA calculator and i need to take multiple inputs from single edit text. I needed up to add a whole quality point table for six subjects. This thing is itching me as multiple if conditions are very confusing. As the table points are based on credit hours.
b is showing credit hours
w is showing the marks obtained and their according quality grade points.
if (b == 2) {
String M1 = etM1.getText ().toString ();
w = Integer.parseInt (M1);
if (w == 16) {
w = Float.parseFloat (String.valueOf (2));
} else if (w == 17) {
w = Float.parseFloat (String.valueOf (2.5));
} else if (w == 18) {
w = Float.parseFloat (String.valueOf (3));
} else if (w == 19) {
w = Float.parseFloat (String.valueOf (3.5));
} else if (w == 20) {
w = Float.parseFloat (String.valueOf (4));
} else if (w == 21) {
w = Float.parseFloat (String.valueOf (4.33));
} else if (w == 22) {
w = Float.parseFloat (String.valueOf (4.67));
} else if (w == 23) {
w = Float.parseFloat (String.valueOf (5));
} else if (w == 24) {
w = Float.parseFloat (String.valueOf (5.33));
} else if (w == 25) {
w = Float.parseFloat (String.valueOf (5.67));
} else if (w == 26) {
w = Float.parseFloat (String.valueOf (6));
} else if (w == 27) {
w = Float.parseFloat (String.valueOf (6.33));
} else if (w == 28) {
w = Float.parseFloat (String.valueOf (6.67));
} else if (w == 29) {
w = Float.parseFloat (String.valueOf (7));
} else if (w == 30) {
w = Float.parseFloat (String.valueOf (7.33));
} else if (w == 31) {
w = Float.parseFloat (String.valueOf (7.67));
} else if (w == 32 || w <= 40) {
w = Float.parseFloat (String.valueOf (8));
}
} else if (b == 3) {
String M1 = etM1.getText ().toString ();
w = Integer.parseInt (M1);
if (w == 24) {
w = Float.parseFloat (String.valueOf (3));
} else if (w == 25) {
w = Float.parseFloat (String.valueOf (3.5));
} else if (w == 26) {
w = Float.parseFloat (String.valueOf (4));
} else if (w == 27) {
w = Float.parseFloat (String.valueOf (4.5));
} else if (w == 28) {
w = Float.parseFloat (String.valueOf (5));
} else if (w == 29) {
w = Float.parseFloat (String.valueOf (5.5));
} else if (w == 30) {
w = Float.parseFloat (String.valueOf (6));
} else if (w == 31) {
w = Float.parseFloat (String.valueOf (6.33));
} else if (w == 32) {
w = Float.parseFloat (String.valueOf (6.67));
} else if (w == 33) {
w = Float.parseFloat (String.valueOf (7));
} else if (w == 34) {
w = Float.parseFloat (String.valueOf (7.33));
} else if (w == 35) {
w = Float.parseFloat (String.valueOf (7.67));
} else if (w == 36) {
w = Float.parseFloat (String.valueOf (8));
} else if (w == 37) {
w = Float.parseFloat (String.valueOf (8.33));
} else if (w == 38) {
w = Float.parseFloat (String.valueOf (8.67));
} else if (w == 39) {
w = Float.parseFloat (String.valueOf (9));
} else if (w == 40) {
w = Float.parseFloat (String.valueOf (9.33));
} else if (w == 41) {
w = Float.parseFloat (String.valueOf (9.67));
} else if (w == 42) {
w = Float.parseFloat (String.valueOf (10));
} else if (w == 43) {
w = Float.parseFloat (String.valueOf (10.33));
} else if (w == 44) {
w = Float.parseFloat (String.valueOf (10.67));
} else if (w == 45) {
w = Float.parseFloat (String.valueOf (11));
} else if (w == 46) {
w = Float.parseFloat (String.valueOf (11.33));
} else if (w == 47) {
w = Float.parseFloat (String.valueOf (11.67));
} else if (w == 48 || w <= 60) {
w = Float.parseFloat (String.valueOf (12));
}
}`
android
New contributor
$endgroup$
put on hold as unclear what you're asking by 200_success, Jamal♦ 1 hour ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I am creating a CGPA calculator and i need to take multiple inputs from single edit text. I needed up to add a whole quality point table for six subjects. This thing is itching me as multiple if conditions are very confusing. As the table points are based on credit hours.
b is showing credit hours
w is showing the marks obtained and their according quality grade points.
if (b == 2) {
String M1 = etM1.getText ().toString ();
w = Integer.parseInt (M1);
if (w == 16) {
w = Float.parseFloat (String.valueOf (2));
} else if (w == 17) {
w = Float.parseFloat (String.valueOf (2.5));
} else if (w == 18) {
w = Float.parseFloat (String.valueOf (3));
} else if (w == 19) {
w = Float.parseFloat (String.valueOf (3.5));
} else if (w == 20) {
w = Float.parseFloat (String.valueOf (4));
} else if (w == 21) {
w = Float.parseFloat (String.valueOf (4.33));
} else if (w == 22) {
w = Float.parseFloat (String.valueOf (4.67));
} else if (w == 23) {
w = Float.parseFloat (String.valueOf (5));
} else if (w == 24) {
w = Float.parseFloat (String.valueOf (5.33));
} else if (w == 25) {
w = Float.parseFloat (String.valueOf (5.67));
} else if (w == 26) {
w = Float.parseFloat (String.valueOf (6));
} else if (w == 27) {
w = Float.parseFloat (String.valueOf (6.33));
} else if (w == 28) {
w = Float.parseFloat (String.valueOf (6.67));
} else if (w == 29) {
w = Float.parseFloat (String.valueOf (7));
} else if (w == 30) {
w = Float.parseFloat (String.valueOf (7.33));
} else if (w == 31) {
w = Float.parseFloat (String.valueOf (7.67));
} else if (w == 32 || w <= 40) {
w = Float.parseFloat (String.valueOf (8));
}
} else if (b == 3) {
String M1 = etM1.getText ().toString ();
w = Integer.parseInt (M1);
if (w == 24) {
w = Float.parseFloat (String.valueOf (3));
} else if (w == 25) {
w = Float.parseFloat (String.valueOf (3.5));
} else if (w == 26) {
w = Float.parseFloat (String.valueOf (4));
} else if (w == 27) {
w = Float.parseFloat (String.valueOf (4.5));
} else if (w == 28) {
w = Float.parseFloat (String.valueOf (5));
} else if (w == 29) {
w = Float.parseFloat (String.valueOf (5.5));
} else if (w == 30) {
w = Float.parseFloat (String.valueOf (6));
} else if (w == 31) {
w = Float.parseFloat (String.valueOf (6.33));
} else if (w == 32) {
w = Float.parseFloat (String.valueOf (6.67));
} else if (w == 33) {
w = Float.parseFloat (String.valueOf (7));
} else if (w == 34) {
w = Float.parseFloat (String.valueOf (7.33));
} else if (w == 35) {
w = Float.parseFloat (String.valueOf (7.67));
} else if (w == 36) {
w = Float.parseFloat (String.valueOf (8));
} else if (w == 37) {
w = Float.parseFloat (String.valueOf (8.33));
} else if (w == 38) {
w = Float.parseFloat (String.valueOf (8.67));
} else if (w == 39) {
w = Float.parseFloat (String.valueOf (9));
} else if (w == 40) {
w = Float.parseFloat (String.valueOf (9.33));
} else if (w == 41) {
w = Float.parseFloat (String.valueOf (9.67));
} else if (w == 42) {
w = Float.parseFloat (String.valueOf (10));
} else if (w == 43) {
w = Float.parseFloat (String.valueOf (10.33));
} else if (w == 44) {
w = Float.parseFloat (String.valueOf (10.67));
} else if (w == 45) {
w = Float.parseFloat (String.valueOf (11));
} else if (w == 46) {
w = Float.parseFloat (String.valueOf (11.33));
} else if (w == 47) {
w = Float.parseFloat (String.valueOf (11.67));
} else if (w == 48 || w <= 60) {
w = Float.parseFloat (String.valueOf (12));
}
}`
android
New contributor
$endgroup$
put on hold as unclear what you're asking by 200_success, Jamal♦ 1 hour ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I am creating a CGPA calculator and i need to take multiple inputs from single edit text. I needed up to add a whole quality point table for six subjects. This thing is itching me as multiple if conditions are very confusing. As the table points are based on credit hours.
b is showing credit hours
w is showing the marks obtained and their according quality grade points.
if (b == 2) {
String M1 = etM1.getText ().toString ();
w = Integer.parseInt (M1);
if (w == 16) {
w = Float.parseFloat (String.valueOf (2));
} else if (w == 17) {
w = Float.parseFloat (String.valueOf (2.5));
} else if (w == 18) {
w = Float.parseFloat (String.valueOf (3));
} else if (w == 19) {
w = Float.parseFloat (String.valueOf (3.5));
} else if (w == 20) {
w = Float.parseFloat (String.valueOf (4));
} else if (w == 21) {
w = Float.parseFloat (String.valueOf (4.33));
} else if (w == 22) {
w = Float.parseFloat (String.valueOf (4.67));
} else if (w == 23) {
w = Float.parseFloat (String.valueOf (5));
} else if (w == 24) {
w = Float.parseFloat (String.valueOf (5.33));
} else if (w == 25) {
w = Float.parseFloat (String.valueOf (5.67));
} else if (w == 26) {
w = Float.parseFloat (String.valueOf (6));
} else if (w == 27) {
w = Float.parseFloat (String.valueOf (6.33));
} else if (w == 28) {
w = Float.parseFloat (String.valueOf (6.67));
} else if (w == 29) {
w = Float.parseFloat (String.valueOf (7));
} else if (w == 30) {
w = Float.parseFloat (String.valueOf (7.33));
} else if (w == 31) {
w = Float.parseFloat (String.valueOf (7.67));
} else if (w == 32 || w <= 40) {
w = Float.parseFloat (String.valueOf (8));
}
} else if (b == 3) {
String M1 = etM1.getText ().toString ();
w = Integer.parseInt (M1);
if (w == 24) {
w = Float.parseFloat (String.valueOf (3));
} else if (w == 25) {
w = Float.parseFloat (String.valueOf (3.5));
} else if (w == 26) {
w = Float.parseFloat (String.valueOf (4));
} else if (w == 27) {
w = Float.parseFloat (String.valueOf (4.5));
} else if (w == 28) {
w = Float.parseFloat (String.valueOf (5));
} else if (w == 29) {
w = Float.parseFloat (String.valueOf (5.5));
} else if (w == 30) {
w = Float.parseFloat (String.valueOf (6));
} else if (w == 31) {
w = Float.parseFloat (String.valueOf (6.33));
} else if (w == 32) {
w = Float.parseFloat (String.valueOf (6.67));
} else if (w == 33) {
w = Float.parseFloat (String.valueOf (7));
} else if (w == 34) {
w = Float.parseFloat (String.valueOf (7.33));
} else if (w == 35) {
w = Float.parseFloat (String.valueOf (7.67));
} else if (w == 36) {
w = Float.parseFloat (String.valueOf (8));
} else if (w == 37) {
w = Float.parseFloat (String.valueOf (8.33));
} else if (w == 38) {
w = Float.parseFloat (String.valueOf (8.67));
} else if (w == 39) {
w = Float.parseFloat (String.valueOf (9));
} else if (w == 40) {
w = Float.parseFloat (String.valueOf (9.33));
} else if (w == 41) {
w = Float.parseFloat (String.valueOf (9.67));
} else if (w == 42) {
w = Float.parseFloat (String.valueOf (10));
} else if (w == 43) {
w = Float.parseFloat (String.valueOf (10.33));
} else if (w == 44) {
w = Float.parseFloat (String.valueOf (10.67));
} else if (w == 45) {
w = Float.parseFloat (String.valueOf (11));
} else if (w == 46) {
w = Float.parseFloat (String.valueOf (11.33));
} else if (w == 47) {
w = Float.parseFloat (String.valueOf (11.67));
} else if (w == 48 || w <= 60) {
w = Float.parseFloat (String.valueOf (12));
}
}`
android
New contributor
$endgroup$
I am creating a CGPA calculator and i need to take multiple inputs from single edit text. I needed up to add a whole quality point table for six subjects. This thing is itching me as multiple if conditions are very confusing. As the table points are based on credit hours.
b is showing credit hours
w is showing the marks obtained and their according quality grade points.
if (b == 2) {
String M1 = etM1.getText ().toString ();
w = Integer.parseInt (M1);
if (w == 16) {
w = Float.parseFloat (String.valueOf (2));
} else if (w == 17) {
w = Float.parseFloat (String.valueOf (2.5));
} else if (w == 18) {
w = Float.parseFloat (String.valueOf (3));
} else if (w == 19) {
w = Float.parseFloat (String.valueOf (3.5));
} else if (w == 20) {
w = Float.parseFloat (String.valueOf (4));
} else if (w == 21) {
w = Float.parseFloat (String.valueOf (4.33));
} else if (w == 22) {
w = Float.parseFloat (String.valueOf (4.67));
} else if (w == 23) {
w = Float.parseFloat (String.valueOf (5));
} else if (w == 24) {
w = Float.parseFloat (String.valueOf (5.33));
} else if (w == 25) {
w = Float.parseFloat (String.valueOf (5.67));
} else if (w == 26) {
w = Float.parseFloat (String.valueOf (6));
} else if (w == 27) {
w = Float.parseFloat (String.valueOf (6.33));
} else if (w == 28) {
w = Float.parseFloat (String.valueOf (6.67));
} else if (w == 29) {
w = Float.parseFloat (String.valueOf (7));
} else if (w == 30) {
w = Float.parseFloat (String.valueOf (7.33));
} else if (w == 31) {
w = Float.parseFloat (String.valueOf (7.67));
} else if (w == 32 || w <= 40) {
w = Float.parseFloat (String.valueOf (8));
}
} else if (b == 3) {
String M1 = etM1.getText ().toString ();
w = Integer.parseInt (M1);
if (w == 24) {
w = Float.parseFloat (String.valueOf (3));
} else if (w == 25) {
w = Float.parseFloat (String.valueOf (3.5));
} else if (w == 26) {
w = Float.parseFloat (String.valueOf (4));
} else if (w == 27) {
w = Float.parseFloat (String.valueOf (4.5));
} else if (w == 28) {
w = Float.parseFloat (String.valueOf (5));
} else if (w == 29) {
w = Float.parseFloat (String.valueOf (5.5));
} else if (w == 30) {
w = Float.parseFloat (String.valueOf (6));
} else if (w == 31) {
w = Float.parseFloat (String.valueOf (6.33));
} else if (w == 32) {
w = Float.parseFloat (String.valueOf (6.67));
} else if (w == 33) {
w = Float.parseFloat (String.valueOf (7));
} else if (w == 34) {
w = Float.parseFloat (String.valueOf (7.33));
} else if (w == 35) {
w = Float.parseFloat (String.valueOf (7.67));
} else if (w == 36) {
w = Float.parseFloat (String.valueOf (8));
} else if (w == 37) {
w = Float.parseFloat (String.valueOf (8.33));
} else if (w == 38) {
w = Float.parseFloat (String.valueOf (8.67));
} else if (w == 39) {
w = Float.parseFloat (String.valueOf (9));
} else if (w == 40) {
w = Float.parseFloat (String.valueOf (9.33));
} else if (w == 41) {
w = Float.parseFloat (String.valueOf (9.67));
} else if (w == 42) {
w = Float.parseFloat (String.valueOf (10));
} else if (w == 43) {
w = Float.parseFloat (String.valueOf (10.33));
} else if (w == 44) {
w = Float.parseFloat (String.valueOf (10.67));
} else if (w == 45) {
w = Float.parseFloat (String.valueOf (11));
} else if (w == 46) {
w = Float.parseFloat (String.valueOf (11.33));
} else if (w == 47) {
w = Float.parseFloat (String.valueOf (11.67));
} else if (w == 48 || w <= 60) {
w = Float.parseFloat (String.valueOf (12));
}
}`
android
android
New contributor
New contributor
New contributor
asked 2 hours ago
Asad Ur Rehman KhanAsad Ur Rehman Khan
11
11
New contributor
New contributor
put on hold as unclear what you're asking by 200_success, Jamal♦ 1 hour ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by 200_success, Jamal♦ 1 hour ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes