use FH;
AF: SS_Float;
- Int_Part_Got: Integer;
- Int_Part_Calcd: Integer;
- Dec_Part_Got: SS_Float;
- Dec_Part_Calcd: SS_Float;
- Exp_Part_Got: Integer;
- Exp_Part_Calcd: Integer;
+ Int_Part_A_Str: UB_Text;
+ Dec_Part_A_Str: UB_Text;
+ Exp_Part_A_Str: UB_Text;
+ Int_Part_C_Str: UB_Text;
+ Dec_Part_C_Str: UB_Text;
+ Exp_Part_C_Str: UB_Text;
+ VType_Str: UB_Text;
+ Units_Str: UB_Text;
begin
-- Check that there is a valid answer in the map
if Answer.Find(ANSWER_NUM_KEY) = Answer_Info.No_Element then
return Malformed_Answer;
end;
- Split_Integer_Decimal_Exponent_Nums(AF, Decimals, Int_Part_Got, Dec_Part_Got, Exp_Part_Got);
- Split_Integer_Decimal_Exponent_Nums(Problem.Answer_Num, Decimals, Int_Part_Calcd, Dec_Part_Calcd, Exp_Part_Calcd);
+ Split_Integer_Decimal_Exponent_Strs(AF, DECIMALS, Int_Part_A_Str, Dec_Part_A_Str, Exp_Part_A_Str);
+ Split_Integer_Decimal_Exponent_Strs(Problem.Answer_Num, DECIMALS, Int_Part_C_Str, Dec_Part_C_Str, Exp_Part_C_Str);
- --Ada.Text_IO.Put_Line(SS_Float'Image(AF) & " " & Integer'Image(Int_Part_Got) & " " & SS_Float'Image(Dec_Part_Got) & " " & Integer'Image(Exp_Part_Got));
- --Ada.Text_IO.Put_Line(SS_Float'Image(Problem.Answer_Num) & " " & Integer'Image(Int_Part_Calcd) & " " & SS_Float'Image(Dec_Part_Calcd) & " " & Integer'Image(Exp_Part_Calcd));
+ case Problem.Parameters.P_Subtype is
+ when V_FROM_G_KS =>
+ VType_Str := To_UB_Text("V = ");
+ Units_Str := To_UB_Text(" dm<span class=""exponent"">3</span>");
+ when KS_FROM_G_V =>
+ VType_Str := To_UB_Text("K<span class=""subscript"">s</span> = ");
+ Units_Str := To_UB_Text("");
+ when C_FROM_KS_DIFFERENT_IONS | C_FROM_KS_SHARED_ION =>
+ VType_Str := To_UB_Text("c = ");
+ Units_Str := To_UB_Text(" mol/dm<span class=""exponent"">3</span>");
+ end case;
- if Int_Part_Got /= Int_Part_Calcd or Exp_Part_Got /= Exp_Part_Calcd then
- Message := To_UB_Text("Špatná odpověď, správný výsledek je ");
- Get_Precise_Answer_String(Message, Problem.Parameters.P_Subtype, Problem.Answer_Num);
- return Wrong_Answer;
- end if;
+ Message := To_UB_Text("Odpověď vypočtená programem: ") & VType_Str & Int_Part_C_Str & To_UB_Text(",") & Dec_Part_C_Str & To_UB_Text(" . 10") & To_UB_Text("<span class=""exponent"">") & Exp_Part_C_Str & To_UB_Text("</span>") & Units_Str & To_UB_Text(" - Vaše odpověď: ") & VType_Str & Int_Part_A_Str & To_UB_Text(",") & Dec_Part_A_Str & To_UB_Text(" . 10") & To_UB_Text("<span class=""exponent"">") & Exp_Part_A_Str & To_UB_Text("</span>") & Units_Str;
- if (Dec_Part_Calcd + PRECISION) > Dec_Part_Got and (Dec_Part_Calcd - PRECISION) < Dec_Part_Got then
- Message := To_UB_Text("Správná odpověď");
- return Correct_Answer;
- else
- Message := To_UB_Text("Špatná odpověď, správný výsledek je ");
- Get_Precise_Answer_String(Message, Problem.Parameters.P_Subtype, Problem.Answer_Num);
- return Wrong_Answer;
- end if;
+ return Correct_Answer;
end Check_Answer;
function Get_Assignment(Problem: in out Solubility_Problem; Assignment: in out Assignment_Info.Map; Resource_Prefix: in String) return RetCode is