Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
}
@SandPadres

This comment has been minimized.

Copy link

SandPadres commented Aug 13, 2015

In Method 1 "It is ' + event + '" is incorrect. You declared a String called eventName so it should be "It is ' + eventName + '".

@mkreager

This comment has been minimized.

Copy link

mkreager commented Aug 23, 2015

Minor revision as noted by SandPadres: https://gist.github.com/mkreager/1ffe089bd27d58d08aae

@ineedone

This comment has been minimized.

Copy link

ineedone commented Nov 2, 2015

Method one still isn't correct: it still says event vs eventName

reminder = reminder + " It is " + eventName + " held at " + location + ".";

@udacityandroid

This comment has been minimized.

Copy link
Owner Author

udacityandroid commented Dec 7, 2015

Thanks everyone, fixed now!

@angel-tren

This comment has been minimized.

Copy link

angel-tren commented May 28, 2016

Vamos bien, sigamos adelante, espero que haya un compañero que hable español y esté igual intyeresado que yo en esto para que trabajemos juntos

@angel-tren

This comment has been minimized.

Copy link

angel-tren commented May 28, 2016

Vamos bien, sigamos adelante, espero que haya un compañero que hable español y esté igual interesado que yo en esto para que trabajemos juntos

@jenr911

This comment has been minimized.

Copy link

jenr911 commented Jul 30, 2016

Hola angel-tren, ya somos dos que hablamos español.

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 8, 2016

Yo también hablo español @jernr911

@Patriciasr92

This comment has been minimized.

Copy link

Patriciasr92 commented Aug 22, 2016

Somos cuatro :)

@linix22

This comment has been minimized.

Copy link

linix22 commented Sep 19, 2016

ya somos cinco :)

@josueetcom

This comment has been minimized.

Copy link

josueetcom commented Oct 2, 2016

Y conmigo son seis que han comentado. :) @angel-tren @jenr911 @luistejadaa @Patriciasr92 @linix22

@BrianGaucher

This comment has been minimized.

Copy link

BrianGaucher commented Nov 5, 2016

Ja ja ja, yo soy un Canadien y yo puede hablo un poco de Espagnol. Si nuetros son siete que hablamos espagnol.

@MuhammadSugiharto

This comment has been minimized.

Copy link

MuhammadSugiharto commented Nov 14, 2016

why return data type in methode 2 which my answer is int is wrong?

@benja90

This comment has been minimized.

Copy link

benja90 commented Dec 5, 2016

8 me apunto a la comunidad en español!!! solicitedes un curso de android en español a la altura de Google :D

@itechmode

This comment has been minimized.

Copy link

itechmode commented Jan 11, 2017

Algum brasileiro?
todavía también ablo español/also speak english

@Obalolu

This comment has been minimized.

Copy link

Obalolu commented Jan 12, 2017

it worked for me

@winnieCZ

This comment has been minimized.

Copy link

winnieCZ commented Jan 21, 2017

Nice and clear :-)

@sosmygirl

This comment has been minimized.

Copy link

sosmygirl commented Feb 22, 2017

it wonderful

@jcunanan05

This comment has been minimized.

Copy link

jcunanan05 commented Mar 6, 2017

thanks

@PascalR2014

This comment has been minimized.

Copy link

PascalR2014 commented Mar 23, 2017

Salut !

@gurutecno

This comment has been minimized.

Copy link

gurutecno commented Apr 8, 2017

Esta identificación ha sido sencilla. Vamos a ver como siguen los vídeos.
Saludos!

@rebekaszucs

This comment has been minimized.

Copy link

rebekaszucs commented Apr 10, 2017

cool and understandable:)

@badeyemo

This comment has been minimized.

Copy link

badeyemo commented May 24, 2017

Its clear and understandable.

@Damithsdemel

This comment has been minimized.

Copy link

Damithsdemel commented Jul 6, 2017

noticed and understood

@ghost

This comment has been minimized.

Copy link

ghost commented Jul 21, 2017

Lets go everybody. Don't quit now. We can learn it.

@ghost

This comment has been minimized.

Copy link

ghost commented Jul 21, 2017

It's option C

@Guille55

This comment has been minimized.

Copy link

Guille55 commented Aug 26, 2017

ya somos 9 !!
en español! Saludos

@jhojav94

This comment has been minimized.

Copy link

jhojav94 commented Aug 29, 2017

salut x2

@mirmueen

This comment has been minimized.

Copy link

mirmueen commented Oct 1, 2017

done

@Ahmed012345

This comment has been minimized.

Copy link

Ahmed012345 commented Oct 5, 2017

thanks

@pushpalroy

This comment has been minimized.

Copy link

pushpalroy commented Dec 19, 2017

Please try not to copy and paste from here, because it will copy extra whitespace characters along with the copied part, which will evaluate your answer as incorrect.

@dennisotugo

This comment has been minimized.

Copy link

dennisotugo commented Jan 25, 2018

dab dab dab dab dab dab dab

@adeadelina

This comment has been minimized.

Copy link

adeadelina commented Jan 31, 2018

wow @pushpalroy thanks! glad i scrolled all the way here... I really couldn't see why my answers were incorrect

@Maxwe1

This comment has been minimized.

Copy link

Maxwe1 commented Feb 4, 2018

Working well. @pushpalory, I always make sure first that no white spaces around.

@abdahma01

This comment has been minimized.

Copy link

abdahma01 commented Feb 15, 2018

untitled

@badrddinb

This comment has been minimized.

Copy link

badrddinb commented Feb 25, 2018

DONE

@rashibudati

This comment has been minimized.

Copy link

rashibudati commented Mar 4, 2018

oops
I am repeatedly getting error in the method 3. Is anything wrong?

@oddmentiusmaximus

This comment has been minimized.

Copy link

oddmentiusmaximus commented Mar 10, 2018

if anyone is getting an error on String,int,String in return data type then try writing the code without leaving any space after the types are written ,my answer was giving error because of the space after the word

@ashutoshshah18

This comment has been minimized.

Copy link

ashutoshshah18 commented Mar 13, 2018

Getting the same error as posted above by rashibudati.

@louayeldin

This comment has been minimized.

Copy link

louayeldin commented Mar 18, 2018

Awesome, Done!

@MrRobot-Root

This comment has been minimized.

Copy link

MrRobot-Root commented Mar 25, 2018

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

@hudsonpereira

This comment has been minimized.

Copy link

hudsonpereira commented May 6, 2018

Done

@iammahesh99

This comment has been minimized.

Copy link

iammahesh99 commented May 8, 2018

done with it

@shoooka

This comment has been minimized.

Copy link

shoooka commented May 10, 2018

done

@Eduese

This comment has been minimized.

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

@rootkit07

This comment has been minimized.

Copy link

rootkit07 commented May 25, 2018

This is cool, a lot of things to learn.

@eiadt

This comment has been minimized.

Copy link

eiadt commented May 29, 2018

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

@amine2ng

This comment has been minimized.

Copy link

amine2ng commented May 30, 2018

thank you so much

@tooptooptoop

This comment has been minimized.

Copy link

tooptooptoop commented Jun 8, 2018

done

@MijeLafe

This comment has been minimized.

Copy link

MijeLafe commented Jun 8, 2018

done

@Fury4hwxc

This comment has been minimized.

Copy link

Fury4hwxc commented Jun 16, 2018

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

@raDIUM2010

This comment has been minimized.

Copy link

raDIUM2010 commented Jun 20, 2018

Done

@alitariqali

This comment has been minimized.

Copy link

alitariqali commented Jun 26, 2018

Done

@WasimNasrallah

This comment has been minimized.

Copy link

WasimNasrallah commented Jul 8, 2018

done

@emanhamad

This comment has been minimized.

Copy link

emanhamad commented Sep 6, 2018

done
aaaa

@MostafaAtefsaber

This comment has been minimized.

Copy link

MostafaAtefsaber commented Oct 9, 2018

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

MasterSami1985 commented Jul 2, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.