Processing Assignment - Team Points
Need Help? This assignment has some similarities to the Guitar Store example we did in class. In case you had trouble or were absent from that class, I have copied and pasted a version of that code at the end of this document to help.
Create a P5.js file called Assign3_Points to keep track of points in a competition such as a Music Competition or a Sports League.
Step 1 - Set Up
Set up your window to be 800,600 to start. Give yourself a light colored background.
Step 2 - Set up Team Names
a) Create a variable called team1name.
b) Put the name of a team into the variable
c) Repeat the above for 2 more teams. Use team2name and team3name.
Step 3 - Set Up Wins and Losses (or Judges Scores, or ???)
Create 6 variables for the wins and losses of 3 teams and decide how many wins and losses each should have. For example:
int team1Wins = 9;
int team1Losses= 7; (do this for all 3 teams)
Step 4 - Calculate Points
Create 3 more int variables that store the total points for each team (such as team1Points). The points must be calculated using a formula.
Step 5 - Print Titles
Note, you may want to read and complete the ‘Final 10%’ section before beginning this step.
a) Adding a font is optional. Make your font color is dark.
b) Using text(), headings row for a table that you will fill with stats: For a sports league, it might look like:
Team Wins Losses Points
For a music competition, it might look like:
Team Judge 1 Judge 2 Average
Step 6 - Print all statistics
Underline the headings row using a simple line().
Using the variables, print out the statistics table.
Overall, your table should look similar to the following:
Team Wins Losses Points
____________________________________________
Eskimos 9 7 18
Argos 6 10 12
Stampeders 2 14 4
or
Competitor Judge 1 Judge 2 Total
__________________________________________
KPop Kids 45 37 82
Poppin’ Bob 39 65 104
Coups Troop 80 78 158
Stop here for 80%
Next 10% - Step 7
Add a keyPressed and mousePressed function to your program so that:
Be sure to recalculate your teamPoints variables if they do not already update.
Final 10% - Step 8 - Background Picture
Evaluation
I will be checking out the following:
Setting up variables - 50%
Printing Table - 30%
KeyPressed & MousePressed Functions - 10%
Background Picture 10%
Need help? Simplified Guitar Store In-class Example
String product1 = "Fender Stratocaster";
float price1 = 799.89;
int bought1 = 1;
String product2 = "Marshal Amp";
float price2 = 1200.89;
int bought2 = 2;
String product3 = "Set of strings";
float price3 = 12.56;
int bought3 = 5;
void setup(){
size( 600, 500);
background (24,98,200);
}
void draw(){
background (24,98,200);
image(backpicture, 0,0, width, height);
fill(255,255,0);
text(product1, 50,50);
text(price1, 225,50);
text(bought1, 325,50);
text(product2, 50,70);
text(price2, 225,70);
text(bought2, 325,70);
text(product3, 50,90);
text(price3, 225,90);
text(bought3, 325,90);
fill(255,100,0);
float totalTemp = price1 * bought1 * 1.05;
text("$ " + totalTemp, 375, 50);
totalTemp = price2 * bought2 * 1.05;
text("$ " + totalTemp, 375, 70);
totalTemp = price3 * bought3 * 1.05;
text("$ " + totalTemp, 375, 90);
text("Thank you for shopping at \nCouprie's guitars, please come again.", 50, 120);
}