Create Performance Task
- Program Purpose & Algorithm Implementation
- Data Abstraction & Managing Complexity
- Procedural Abstraction
Program Purpose & Algorithm Implementation
On the game section of our website there is an option for how many shares of a certain stock you would like to purchase (the input), the program will then multiply the stock price by the imputed value and give the product of the equation as the amount spent (output).
Here is an example of how the code will work-
<body>
<head>
<script>
function notify() {
alert(document.getElementById("result").innerHTML = "Result: " + result);
}
</script>
</head>
<body>
<p id="result"></p>
<script>
function multiplyByTwo() {
var num = document.getElementById("numInput").value;
var result = num * 141.86;
alert(document.getElementById("result").innerHTML = "Just confirming the transaction of $" + result);
}
</script>
</body>
Data Abstraction & Managing Complexity
On the section of the website referred to as the “game” the output to the code above will be stored in a list and when called upon will subtract the stored (listed) values from your wallet (your cash holdings). The same information will be pulled to display a visual of your earning report when the game is finished playing.
Here is an example of how the code will work-
def store_input_in_list():
input_list = []
input_value = input("Enter a value: ")
input_list.append(input_value)
return input_list
print(store_input_in_list())
def add_to_10000(input_list):
value = input_list[0]
result = int(value) + 10000
return result
input_list = [5]
print(add_to_10000(input_list))