Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##DESCRIPTION
- ## PreAlgebra problem:
- ##ENDDESCRIPTION
- ##KEYWORDS('prealgebra','common core')
- ## DBsubject('Arithmetic')
- ## DBchapter('Integers')
- ## DBsection('Addition/subtraction')
- ## Date('2/26/2015')
- ## Author('Andrew Parker')
- ## Institution('NYC CityTech')
- ## ProblemTester('')
- ## TitleText1('')
- ## Publisher('')
- ## EditionText1('')
- ## AuthorText1('')
- ## Section1('')
- ## Problem1('')
- ########################################################################
- DOCUMENT();
- loadMacros(
- "PGstandard.pl", # Standard macros for PG language
- "MathObjects.pl",
- "problemRandomize.pl",
- "parserPopUp.pl",
- "scaffold.pl"
- );
- # Print problem number and point value (weight) for the problem
- TEXT(beginproblem());
- # Allow for the user to try another version of the problem once they get it correct.
- ProblemRandomize(when=>"Correct",onlyAfterDue=>0);
- # Show which answers are correct and which ones are incorrect
- $showPartialCorrectAnswers = 0;
- ##############################################################
- #
- # Setup
- #
- #
- ## Part 1: Car Payment ##
- $debt = random(1,5,1)*5000;
- $cash = random(1,9,2)*250;
- $total = Real( -1*$debt + $cash );
- $popup1 = PopUp(["?", "Positive", "Negative"], "Negative");
- $popup2 = PopUp(["?", "Positive", "Negative"], "Positive");
- $popup3 = PopUp(["?", "We owe more.", "We have more."], "We owe more.");
- ## Part 2: Buying an apartment ##
- $cost = random(3,9,1)*25000;
- $down = random(4,9,1)*5000;
- $loan = Real(-1*$cost + $down );
- $popup4 = PopUp(["?", "Money left over.", "In debt."], "In debt.");
- $popup5 = PopUp(["?", "Positive", "Negative"], "Negative");
- ## Part 3: Consolidating Debt ##
- $debt1 = -1*$total;
- $debt2 = -1*$loan;
- $totaldebt = $total+$loan;
- $popup6 = PopUp(["?", "Positive", "Negative"], "Negative");
- ##############################################################
- #
- # Text
- #
- #
- ## to disable arithmetic operations in the answer. Student must simplify.
- Context()->operators->undefine("+","-","*","/");
- ##############################################################
- # Scaffolding
- Scaffold::Begin();
- ##############################################################
- Section::Begin("Part 1: Car payment");
- Context()->texStrings;
- BEGIN_TEXT
- Negative numbers are an essential part of mathematics, they show up as a necessary part of real life. Sometimes, we have to spend money that we don’t actually have – maybe we take out a loan from the bank to pay for a car or a house – and that puts us into debt. Debt is money that we owe as opposed to money that we have. When we owe money, we must take money that we earn and use it to make payments – which reduces our debt.
- $PAR
- For example, lets say we owe the bank $$debt, and we have $$cash that we’re going to use to make a payment on our debt.
- $PAR
- $PAR
- (a) How would you represent our debt of $$debt? Should this number be positive or negative? \{ $popup1->menu() \}
- $BR
- (b) How would you represent our $$cash in cash? Should this number be positive or negative? \{ $popup2->menu() \}
- $BR
- (c) Do we have enough money to pay off the whole debt? Or do we owe more money than what we have? \{ $popup3->menu() \}
- $BR
- (d) Express what we have left after making our payment as a number.
- \{ $total->ans_rule() \}
- END_TEXT
- Context()->normalStrings;
- ANS( $popup1->cmp() );
- ANS( $popup2->cmp() );
- ANS( $popup3->cmp() );
- ANS( $total->cmp() );
- Section::End();
- ##############################################################
- Section::Begin("Part 2: Buying an apartment");
- Context()->texStrings;
- BEGIN_TEXT
- $PAR
- Let’s do another example. Say we want to purchase an apartment, and we have $$down saved up for a down payment. We find an apartment that we want to buy, but it will cost us $$cost.
- $PAR
- $PAR
- (a) If we buy this apartment, will we have money left over? Or will we go into debt? \{ $popup4->menu() \}
- $PAR
- (b) So, will we express the result of our purchase as a positive or negative number? \{ $popup5->menu() \}
- $PAR
- (c) Express the result of our purchase as a number. \{ $loan->ans_rule() \}
- END_TEXT
- Context()->normalStrings;
- ANS( $popup4->cmp() );
- ANS( $popup5->cmp() );
- ANS( $loan->cmp() );
- Section::End();
- ##############################################################
- Section::Begin("Part 3: Consolidating debts");
- Context()->texStrings;
- BEGIN_TEXT
- As our final example, let’s consider what we’d have if both of the previous examples were combined. In the first example we ended up with a final debt of $$debt1, and in the second example, we ended up with a debt of $$debt2.
- $PAR
- $PAR
- (a) If we add the debts together, should it be expressed as a positive or negative number? \{ $popup6->menu() \}
- $PAR
- (b) Express our total debt as a number. \{ $totaldebt->ans_rule() \}
- END_TEXT
- Context()->normalStrings;
- ANS( $popup6->cmp() );
- ANS( $totaldebt->cmp() );
- Section::End();
- Scaffold::End();
- ##############################################################
- #
- # Answers
- #
- #
- ENDDOCUMENT();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement