In my code, I created a virtual organizer that would calculate grades and allow a user to write in events for each day of the week. The code is for demonstration purposes only.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Step One: Day of the Week Table
One of the components I wanted to include was a virtual agenda, complete with days of the week, classes, and slots to write in. I needed to position the lines in the proper places to create a table with all of the necessary slots. So I created a separate file so I could code and then establish my day-of-the-week table.
Step 2: Coding the Grade Table
Another component of my code I wanted to include was a table that would show your classes, teachers, and some grades that you had received in the class, so I had to do a similar thing to my first table and code it in a separate file.
Step 3: Coding Variables
From the get-go, I knew that there would be some basic information I would have to ask the user throughout the code, so I made variables for the ones I knew I’d use for sure. Some examples are their courses, their teachers, the day and class, the fonts, etc.
Step 4: Putting Words Into the Tables
My tables both needed to have labels within them to identify the different components, so I had to put words within them. I figured out coordinates to draw fonts and I figured out how large the fonts had to be to fit, and I made them specific colours. I made a separate file to test this. I had to declare the fonts in the test so that the words would look the way I wanted them to.
Step 5: Coding the Home Screen
I wanted my organizer to have a come screen where they could choose the option that they wanted. I knew that I wanted my components to be then agenda, the course table, a grade calculator, and an option to change your settings. I had to create fonts for this and figure out the coordinates where each word would go. This was made into a separate file.
Step 6: Settings Function
For my settings function, the task was to simply ask the user for all of their information so it was implemented into the code for future procedures. It would ask for your first course then your first teacher, then your second course, etc. At the end, it would show you all of the things you typed out side by side, and it’s would ask if it’s was okay. If it’s wasn’t, you could tell it so and it would ask for your information again. I also chose fonts and colours for the prompts.
Step 7: Coding the Agenda Function
For the agenda function, I wanted the user to be able to type in their tasks directly into the box that they wanted. First it asks for what class and day you want, and then I had to do locate for the location of the cursor. If they chose a specific combination of day and class, I would have a coordinated implemeted so that they would be able to type in the correct spot once it displayed the agenda table. I made a separate file for this, but the only issue was that I would need to declare all of my course variables before it could work, so that took a while.
Step 8: Coding the Grade Calculator
This procedure was fairly standard. I wanted the person to be able to calculate then save their grade. The percentage they received was their mark divided by what the test was out of. Then, the person would put in the course they wanted it saved to and it would appear on their grade table. I had to locate the coordinates so that the grade would go to the correct place.
Step 9: Mouse Clicking Function
I wanted my code to be able to carry out functions without just having users type in input. This is where the mouse clicking function comes in. I did not have an understanding of how to get the mouse to click the screen to get input. During my initial search for inspiration at the very beginning of coding this project, I came across a code on compsci.ca called "The Helicopter Game" in which the code had a mouse clicking function. I used the format of the code within my own code (find the x coordinates, y coordinates, and button status of the mouse) and put an if/then statement. Each statement had coordinates for the mouse that were in accordance with the coordinates of specific words on my home screen, so if you clicked them something specific would happen. If they clikced at that location, then they would get their result.
Step 10: Procedures
I wanted to implement my grade table throughout the code without having to re-write all of the coordinates and fonts over and over again. I also wanted to have the code display the home screen and it's functions each time a function was executed. This is where my procedures came in. I had to declare 3 procedures before my code started: the Grade Table, the Agenda Table, and the Full Code. The Grade Table showed your classes, teachers, and test results, the Agenda had slots to write in tasks, and the Full Code was my entire code copied into a procedure so that once a function was done executing, it would go back to the home screen. I implemented the procedures throughout the code as needed.