Skip to content

Instantly share code, notes, and snippets.

@udacityandroid
Last active February 3, 2023 09:49
Show Gist options
  • Save udacityandroid/90017426439d37728a29 to your computer and use it in GitHub Desktop.
Save udacityandroid/90017426439d37728a29 to your computer and use it in GitHub Desktop.
Android Development for Beginners : Define a Method
private String createCalendarEventReminder(String eventName, String location, int minutesAway) {
String reminder = "You have an upcoming event in " + minutesAway + " minutes.";
reminder = reminder + " It is " + eventName + " held at " + location + ".";
return reminder;
}
private int deductPoints(int pointsUsed) {
// Everyone starts with 100 points
int numberOfPoints = 100 - pointsUsed;
return numberOfPoints;
}
private String findTotalTripLength(int distanceOfFirstTrip, int distanceOfSecondTrip, int distanceOfThirdTrip) {
// Assume we need 2 miles to go to our friend's home (where the trip will start).
int totalLength = 2;
// Then start adding in the trip length.
totalLength = totalLength + distanceOfFirstTrip + distanceOfSecondTrip + distanceOfThirdTrip;
// Form a string to display the total trip length.
String message = "The total trip will be: " + totalLength + " miles.";
return message;
}
@louayeldin
Copy link

Awesome, Done!

@MrRobot-Root
Copy link

I keep getting Try Again Message on method 2 return Data Type which is int

@hudsonpereira
Copy link

Done

@iammahesh99
Copy link

done with it

@shoooka
Copy link

shoooka commented May 10, 2018

done

@Eduese
Copy link

Eduese commented May 21, 2018

Mr. Robot Root, you're supposed to follow instruction from the video and not to run the code. Thanks

Copy link

ghost commented May 25, 2018

This is cool, a lot of things to learn.

@eiadt
Copy link

eiadt commented May 29, 2018

3
4
Hi , I don't know why I have the wrong message ?

@amine2ng
Copy link

thank you so much

@tooptooptoop
Copy link

done

@MijeLafe
Copy link

MijeLafe commented Jun 8, 2018

done

@Fury4hwxc
Copy link

this is the correct answer
must be attention to uppercase
ashampoo_snap_2018 06 16_11h30m39s_001_android track - one million arab coders - udacity - mozilla firefox

Copy link

ghost commented Jun 20, 2018

Done

@alitariqali
Copy link

Done

@WasimNasrallah
Copy link

done

@emanhamad
Copy link

done
aaaa

@MostafaAtefsaber
Copy link

3
4
Hi , I don't know why I have the wrong message ?

I think you copied "String" to Return data type field by double click on "String"
in this case it copy String + space like that
utc
so remove this space

@driss65
Copy link

driss65 commented Dec 24, 2018

Make sure whene you copy-past to remove space at the end of words that you copy.

@MasterSami1985
Copy link

event we do correct , said not correct anyway I passed examin :)

@escobarfan
Copy link

who is doing in 2020?
during the pandemic
well, this course is going great.
[email protected]

@jasvan
Copy link

jasvan commented Jun 6, 2020

Todo bien gracias
Realizando cursos durante la pandemia

@surendra554
Copy link

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment