Created
November 17, 2019 05:38
-
-
Save natendaben/242c4a57da2a34230f641d393362549d to your computer and use it in GitHub Desktop.
Psuedocode for Android version of MyBoulder app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Each pre-defined idea will be stored in an object that has a title, an image, | |
// a description, an address, a category, and various booleans for season compatibility | |
// and whether or not the activity costs money. | |
// Example: | |
public class Idea{ | |
private String title; //name of activity | |
private String imageName; //name of image for activity | |
private String description; //short description | |
private String address; //address of activity location | |
private String category; //can be "outdoors", "urban", or "entertainment" | |
private Boolean summer; | |
private Boolean fall; | |
private Boolean winter; | |
private Boolean spring; | |
private Boolean paid; | |
public Idea(String nTitle, String nImgName, String nDesc, String nAddress, String nCategory, Boolean nFall, Boolean nWinter, Boolean nSpring, Boolean nSummer, Boolean nPaid){ | |
title = nTitle; | |
imageName = nImgName; | |
description = nDesc; | |
address = nAddress; | |
category = nCategory; | |
summer = nSummer; | |
fall = nFall; | |
winter = nWinter; | |
spring = nSpring; | |
paid = nPaid; | |
} | |
} | |
//construct each idea | |
private Idea one = new Idea("title", "imageName", "description", "address", "category", false, false, true, true, false); | |
private Idea two = ....... | |
....etc...... | |
//Store Idea objects in array of objects | |
Idea[] masterList = [one, two ... etc]; | |
// Once I have all of my events in an array, I can iterate through the master array | |
// and add ideas to a new arraylist if they meet the user's criteria. | |
ArrayList<Idea> selectFromThisList; | |
// Make some variables for user preferences | |
String season = "summer"; | |
Boolean userIsWillingToPay = false; | |
//etc. | |
// Use these preferences to iterate through master list and select qualifying ideas | |
for(int i=0; i<masterList.length; i++){ | |
if (season matches and category matches and price matches){ | |
selectFromThisList.add(masterList[i]); | |
} | |
} | |
//select a random idea from selectFromThisList arrayList and pass it to next screen to load in info | |
int length = selectFromThisList.size(); | |
int selectedIndex = use math to select a random number in the range of 0 to (length - 1); | |
Idea selectedIdea = selectFromThisList[selectedIndex]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment