Displaying numerical value from the right formula in the general feedback section

Displaying numerical value from the right formula in the general feedback section

by Armand Majer -
Number of replies: 4

Hello everyone.

I'd like to ask you for some help with the Stack question type. I must confess, and you'll see that, I'm a complete novice in Moodle questions, so I'm sorry if there're some mistakes in the syntax or whatever... I've created a very simple question chemistry based, it is in my language (Slovak), so I'll try to translate it into something that will make sense. smile So, the question itself looks like:

Calculate the mass of KCl that is required to get a solution with a mass fraction of  {@ww@}% KCl as the mass of the solution is equal to {@mm@} g.
When submitting the formula using which you calculated the mass of KCl, type in wA as the mass fraction of KCl, and mR as the mass of the whole solution, include all steps.
1.) Mass of KCl: \(m (KCl)\) = input:ans1 validation:ans1 g
2.) Formula you used to calculate the mass of KCl: \(m (KCl)\)= input:ans2 validation:ans2


The valuables are the following: 

ww: rand([2,3,5,7,11,13,17,19]);

mm: rand([200,300,500,700,1100,1300,1700,2000]);

exp: (wA/100)*mR;

ta1: remainder(exp,x);


The general feedback part includes the following info:

SOLUTION

w KCl = {@ww@} %
w (KCl-nondimensional) = {@ww@}/100
m (of the solution) = {@mm@} g

Calculation

m(KCl) = {@ta1@} g

m(KCl) = ({@ww@}/100)*{@mm@} g
m(KCl) = XXX

Now, if everything's clear, I can proceed to my question itself. Instead of the three Xs I'd like to have there the right numerical answer
coming out of the right formula), so the mass of KCl needed for the solution's preparation.

Thank you in advance. Please, if you can't help, suggest a forum or another page that could lend me a hand solving this.

In case you need other information to understand what I mean, please, do look up this:
1.) inputs
Input:ans1
requires an algebraic input (number) and the formula (model answer) = (ww/100)*mm
Input:ans2
requires an algebraic input (the formula, which is (wA/100)*mR), the model answer is ta1

2.) response trees
Potential response tree: prt1

Node 1: Answer test AlgEquiv ; SAns ans1 ; TAns (ww/100)*mm ; the other parts remain unchanged

Potential response tree: prt1
Node 1: Answer test AlgEquiv ; SAns ans2 ; TAns ta1 ; the other parts remain unchanged
Average of ratings: -
In reply to Armand Majer

Re: Displaying numerical value from the right formula in the general feedback section

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It seems to obviously, but can't you just replace xxx with {@ta1@}?
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Displaying numerical value from the right formula in the general feedback section

by Armand Majer -
Hello, Mr. Hunt. smile Thank you for your advice. I thought about that, but it only shows the formula. I'm really sorry about such a triviality, but I'm trying to get into Moodle, and sometimes I quite don't understand the instructions from the Moodle manual - sometimes it seems to be too complicated, so I've decided to ask for some help up here... I've just started to create quizzes and questions, so I'm a complete novice. smile
In reply to Tim Hunt

Re: Displaying numerical value from the right formula in the general feedback section

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers
ta1 contains variabl wA, mR so it should just display as a formula. To get the numerical result you need to substitute the variables that have the assigned values ww and mm into it to create an expression an then evaluate that expression

{@ (ww/100) * mm @} g actually if you are asking for a numerical answer that value should be assigned to a variable and be the teachers answer for a test ta2.
Average of ratings: Useful (1)
In reply to Daniel Thies

Re: Displaying numerical value from the right formula in the general feedback section

by Armand Majer -
Thank you so much, Mr. Thies. smile It worked, of course.