diff --git a/src/activities/money/money.js b/src/activities/money/money.js index 9585823c1..8b998b08f 100644 --- a/src/activities/money/money.js +++ b/src/activities/money/money.js @@ -1,254 +1,247 @@ /* GCompris - money.js * * Copyright (C) 2014 Bruno Coudoin * * Authors: * Bruno Coudoin (GTK+ version) * Bruno Coudoin (Qt Quick port) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ .pragma library .import "qrc:/gcompris/src/core/core.js" as Core .import GCompris 1.0 as GCompris .import "moneyConstants.js" as Constants var url = "qrc:/gcompris/src/activities/money/resource/" // We create 3 prices categories to make the game more realistic. // List of images to use in the game (cheap objects) var currentLevel var numberOfLevel var dataset var items var centsMode var backMode var priceTotal function start(items_, datasetName) { items = items_ dataset = items.levels switch(datasetName) { case "WITHOUT_CENTS": centsMode = false backMode = false break case "WITH_CENTS": centsMode = true backMode = false break case "BACK_WITHOUT_CENTS": centsMode = false backMode = true break case "BACK_WITH_CENTS": centsMode = true backMode = true break } currentLevel = 0 numberOfLevel = dataset.length initLevel() } function stop() { } function getCoinCount (pocket) { var count = 0 for(var i = 0; i < pocket.length; i++) { if(pocket[i].val <= 2) count++ } return count; } function initLevel() { items.bar.level = currentLevel + 1 items.answerModel.clear() items.pocketModel.clear() var data = dataset[currentLevel] var pocket = Core.shuffle(data.pocket) var coinCount = getCoinCount(pocket) items.pocketRows = ((data.pocket.length - coinCount / 2) > 9) ? 3 : 2 for (var i in pocket) items.pocketModel.append(pocket[i]) // fill up the store in a random way var storeModel = new Array() priceTotal = Math.floor(data.minPrice + Math.random() * (data.maxPrice - data.minPrice)) var priceCounter = 0 for(var i = 0; i < data.numberOfItem; i++) { var price if(i < data.numberOfItem - 1) // Calc a random price for each item based on the previous prices price = Math.floor((centsMode ? 0 : 1) + Math.random() * (2 * (priceTotal - priceCounter) / data.numberOfItem)) else // Put the remaining missing price on the last item price = priceTotal - priceCounter var cents = 0 if(centsMode) { if(currentLevel === 0) cents += 0.10 + Math.floor(Math.random() * 9) / 10 else cents += 0.01 + Math.floor(Math.random() * 9) / 100 priceTotal += cents price += cents } var locale = GCompris.ApplicationSettings.locale if(locale == "system") { locale = Qt.locale().name == "C" ? "en_US" : Qt.locale().name } var priceText = Number(price).toLocaleCurrencyString(Qt.locale(locale)) if(!centsMode) { // Strip floating part priceText = priceText.replace((/.00/), "") } storeModel.push({img: getRandomObject(price), price: priceText}) priceCounter += price } items.store.model = storeModel if(!backMode) { items.instructions.text = qsTr("Click on the coins or paper money at the bottom of the screen to pay." + " If you want to remove a coin or note, click on it on the upper screen area.") } else { - var avaliableCurrency = [] - for(var item in Constants.moneyItems) { - avaliableCurrency.push(Constants.moneyItems[item]) - } - avaliableCurrency.sort(function sort(a, b) { return a.val - b.val }); + var availableCurrency = pocket.slice() + availableCurrency.sort(function sort(a, b) { return b.val - a.val }); var amountToBeCovered = data.paid var tuxMoney = [] while(amountToBeCovered > 0) { - var maxPossible = avaliableCurrency[0] - if(amountToBeCovered >= avaliableCurrency[avaliableCurrency.length - 1].val) - maxPossible = avaliableCurrency[avaliableCurrency.length - 1] - else { - for(var i = 1; i < avaliableCurrency.length; i++) { - if((avaliableCurrency[i].val > amountToBeCovered) && (avaliableCurrency[i - 1].val <= amountToBeCovered)) { - maxPossible = avaliableCurrency[i - 1] - break; - } + var maxPossible = 0 + for(var i = 0; i < availableCurrency.length; i++) { + if((availableCurrency[i].val <= amountToBeCovered)) { + maxPossible = availableCurrency[i] + break; } } tuxMoney.push(maxPossible) amountToBeCovered -= maxPossible.val; } items.tuxMoney.model = tuxMoney var tuxTotal = 0 for(var i=0; i < tuxMoney.length; i++) tuxTotal += tuxMoney[i].val var locale = GCompris.ApplicationSettings.locale if(locale == "system") { locale = Qt.locale().name == "C" ? "en_US" : Qt.locale().name } var priceText = Number(tuxTotal).toLocaleCurrencyString(Qt.locale(locale)) if(!centsMode) { // Strip floating part priceText = priceText.replace((/.00/), "") } /* The money sign is inserted based on the current locale */ items.instructions.text = qsTr("Tux just bought some items in your shop.\n" + "He gives you %1, please give back his change.") .arg(priceText) } //Keyboard reset items.itemIndex = -1 items.selectedArea = items.pocket } // Given a price return a random object function getRandomObject(price) { var list if(price < 5) list = Constants.cheapObjects else if(price < 10) list = Constants.normalObjects else list = Constants.expensiveObjects return list[Math.floor(Math.random() * list.length)] } function checkAnswer() { var paid = 0 for (var i = 0; i < items.answerModel.count; ++i) paid += items.answerModel.get(i).val paid = paid.toFixed(2) if(!backMode) { if(paid === priceTotal.toFixed(2)) items.bonus.good("flower") } else { if(paid === (dataset[currentLevel].paid - priceTotal).toFixed(2)) items.bonus.good("flower") } } function pay(index) { items.audioEffects.play(url + "money1.wav") // Add it to the anwser items.answerModel.append(items.pocketModel.get(index)) // Remove it from the pocket items.pocketModel.remove(index, 1) checkAnswer() } function unpay(index) { items.audioEffects.play(url + "money2.wav") // Add it to the pocket items.pocketModel.append(items.answerModel.get(index)) // Remove it from the Answer items.answerModel.remove(index, 1) checkAnswer() } function nextLevel() { if(numberOfLevel <= ++currentLevel ) { currentLevel = 0 } initLevel(); } function previousLevel() { if(--currentLevel < 0) { currentLevel = numberOfLevel - 1 } initLevel(); } diff --git a/src/activities/money_back/resource/1/Data.qml b/src/activities/money_back/resource/1/Data.qml index d69f472ce..bd5c2a6aa 100644 --- a/src/activities/money_back/resource/1/Data.qml +++ b/src/activities/money_back/resource/1/Data.qml @@ -1,190 +1,192 @@ /* GCompris - Data.qml * * Copyright (C) 2019 Akshay Kumar * * Authors: * Akshay Kumar * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" import "../../../money/moneyConstants.js" as Constants Dataset { objective: qsTr("Learn how to calculate change when amount paid is upto 25 units") property var moneyItems: Constants.moneyItems data: [ { "numberOfItem": 1, "minPrice": 1, "maxPrice": 3, "paid": 10, "pocket": [ moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 5, "paid": 10, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, + moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 8, "paid": 10, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 10, "paid": 15, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 12, "paid": 15, "pocket": [ moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 15, "paid": 20, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 18, "paid": 20, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 20, "paid": 25, "pocket": [ moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 22, "paid": 25, "pocket": [ moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E ] } ] } diff --git a/src/activities/money_back/resource/2/Data.qml b/src/activities/money_back/resource/2/Data.qml index d302c88ea..cc52945f9 100644 --- a/src/activities/money_back/resource/2/Data.qml +++ b/src/activities/money_back/resource/2/Data.qml @@ -1,190 +1,200 @@ /* GCompris - Data.qml * * Copyright (C) 2019 Akshay Kumar * * Authors: * Akshay Kumar * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" import "../../../money/moneyConstants.js" as Constants Dataset { objective: qsTr("Learn how to calculate change when amount paid is upto 100 units") property var moneyItems: Constants.moneyItems data: [ { "numberOfItem": 1, "minPrice": 1, "maxPrice": 10, "paid": 15, "pocket": [ + moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, ] }, { "numberOfItem": 2, "minPrice": 1, "maxPrice": 15, "paid": 20, "pocket": [ + moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 2, "minPrice": 1, "maxPrice": 25, "paid": 30, "pocket": [ + moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 3, "minPrice": 1, "maxPrice": 30, "paid": 40, "pocket": [ + moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 3, "minPrice": 1, "maxPrice": 40, "paid": 50, "pocket": [ + moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 4, "minPrice": 3, "maxPrice": 60, "paid": 100, "pocket": [ + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 4, "minPrice": 4, "maxPrice": 70, "paid": 100, "pocket": [ + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 5, "minPrice": 4, "maxPrice": 80, "paid": 100, "pocket": [ + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 5, "minPrice": 4, "maxPrice": 99, "paid": 100, "pocket": [ + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E ] } ] } diff --git a/src/activities/money_back/resource/3/Data.qml b/src/activities/money_back/resource/3/Data.qml index e69e3118f..fc3ea7acb 100644 --- a/src/activities/money_back/resource/3/Data.qml +++ b/src/activities/money_back/resource/3/Data.qml @@ -1,128 +1,133 @@ /* GCompris - Data.qml * * Copyright (C) 2019 Akshay Kumar * * Authors: * Akshay Kumar * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" import "../../../money/moneyConstants.js" as Constants Dataset { objective: qsTr("Learn how to calculate change when amount paid is upto 400 units") property var moneyItems: Constants.moneyItems data: [ { "numberOfItem": 1, "minPrice": 1, "maxPrice": 49, "paid": 50, "pocket": [ + moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E, ] }, { "numberOfItem": 2, "minPrice": 50, "maxPrice": 99, "paid": 100, "pocket": [ + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 3, "minPrice": 100, "maxPrice": 199, "paid": 200, "pocket": [ + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 4, "minPrice": 200, "maxPrice": 299, "paid": 300, "pocket": [ moneyItems.MONEY_PAPER_200E, + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_1E ] }, { "numberOfItem": 5, "minPrice": 300, "maxPrice": 399, "paid": 400, "pocket": [ + moneyItems.MONEY_PAPER_200E, moneyItems.MONEY_PAPER_200E, moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_COIN_1E ] } ] } diff --git a/src/activities/money_back_cents/resource/1/Data.qml b/src/activities/money_back_cents/resource/1/Data.qml index f74ef8f02..bcff11f2c 100644 --- a/src/activities/money_back_cents/resource/1/Data.qml +++ b/src/activities/money_back_cents/resource/1/Data.qml @@ -1,121 +1,126 @@ /* GCompris - Data.qml * * Copyright (C) 2019 Akshay Kumar * * Authors: * Akshay Kumar * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" import "../../../money/moneyConstants.js" as Constants Dataset { objective: qsTr("Learn how to calculate change including cents when amount paid is upto 5 units") property var moneyItems: Constants.moneyItems data: [ { "numberOfItem": 1, "minPrice": 1, "maxPrice": 3, "paid": 5, "pocket": [ + moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 1, "minPrice": 1, "maxPrice": 3, "paid": 5, "pocket": [ + moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 2, "minPrice": 1, "maxPrice": 3, "paid": 5, "pocket": [ + moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 3, "minPrice": 1, "maxPrice": 3, "paid": 5, "pocket": [ + moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 4, "minPrice": 0, "maxPrice": 4, "paid": 5, "pocket": [ + moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] } ] } diff --git a/src/activities/money_back_cents/resource/2/Data.qml b/src/activities/money_back_cents/resource/2/Data.qml index 5a9d97c47..3827380a0 100644 --- a/src/activities/money_back_cents/resource/2/Data.qml +++ b/src/activities/money_back_cents/resource/2/Data.qml @@ -1,131 +1,136 @@ /* GCompris - Data.qml * * Copyright (C) 2019 Akshay Kumar * * Authors: * Akshay Kumar * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" import "../../../money/moneyConstants.js" as Constants Dataset { objective: qsTr("Learn how to calculate change including cents when amount paid is upto 30 units") property var moneyItems: Constants.moneyItems data: [ { "numberOfItem": 1, "minPrice": 1, "maxPrice": 9, "paid": 10, "pocket": [ + moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 1, "minPrice": 5, "maxPrice": 14, "paid": 15, "pocket": [ + moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 2, "minPrice": 10, "maxPrice": 19, "paid": 20, "pocket": [ + moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 3, "minPrice": 15, "maxPrice": 24, "paid": 25, "pocket": [ + moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 4, "minPrice": 20, "maxPrice": 29, "paid": 30, "pocket": [ moneyItems.MONEY_PAPER_20E, + moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] } ] } diff --git a/src/activities/money_back_cents/resource/3/Data.qml b/src/activities/money_back_cents/resource/3/Data.qml index 51f839a02..d84b5b514 100644 --- a/src/activities/money_back_cents/resource/3/Data.qml +++ b/src/activities/money_back_cents/resource/3/Data.qml @@ -1,146 +1,151 @@ /* GCompris - Data.qml * * Copyright (C) 2019 Akshay Kumar * * Authors: * Akshay Kumar * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 import GCompris 1.0 import "../../../../core" import "../../../money/moneyConstants.js" as Constants Dataset { objective: qsTr("Learn how to calculate change including cents when amount paid is upto 300 units") property var moneyItems: Constants.moneyItems data: [ { "numberOfItem": 1, "minPrice": 30, "maxPrice": 39, "paid": 40, "pocket": [ + moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 1, "minPrice": 40, "maxPrice": 49, "paid": 50, "pocket": [ + moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 2, "minPrice": 50, "maxPrice": 70, "paid": 100, "pocket": [ + moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 3, "minPrice": 100, "maxPrice": 199, "paid": 200, "pocket": [ + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] }, { "numberOfItem": 4, "minPrice": 200, "maxPrice": 299, "paid": 300, "pocket": [ moneyItems.MONEY_PAPER_200E, + moneyItems.MONEY_PAPER_100E, moneyItems.MONEY_PAPER_50E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_20E, moneyItems.MONEY_PAPER_10E, moneyItems.MONEY_PAPER_5E, moneyItems.MONEY_COIN_2E, moneyItems.MONEY_COIN_1E, moneyItems.MONEY_COIN_5C, moneyItems.MONEY_COIN_2C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_50C, moneyItems.MONEY_COIN_20C, moneyItems.MONEY_COIN_10C, moneyItems.MONEY_COIN_1C, moneyItems.MONEY_COIN_1C ] } ] }