Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Android Development for Beginners : Practice Set 2 Currency Conversion Example
int dollars = 40;
int dollarsToYen = 119;
int yen = dollarsToYen * dollars;
display(yen);
@nnannos

This comment has been minimized.

Copy link

commented Apr 9, 2017

Program is correct, displays 4760, it is the result of 119*40

@Mahmoudtarek59

This comment has been minimized.

Copy link

commented Aug 17, 2017

4760

@leoyats

This comment has been minimized.

Copy link

commented Sep 5, 2017

true

@gaietta80

This comment has been minimized.

Copy link

commented Dec 28, 2017

Correct. The result is 4760

@OldWolf55

This comment has been minimized.

Copy link

commented Dec 29, 2017

Yes , it works fine

@Gtstride

This comment has been minimized.

Copy link

commented Jan 2, 2018

Please, I don't seems to understand what line of code is to be written, because, all I have tried isn't going through

@isijackson

This comment has been minimized.

Copy link

commented Jan 23, 2018

40*119 = 4760

@Nogaeman

This comment has been minimized.

Copy link

commented Feb 3, 2018

The Result Is
untitled

@psondagar10

This comment has been minimized.

Copy link

commented Feb 11, 2018

Perfect code

@abdahma01

This comment has been minimized.

Copy link

commented Feb 13, 2018

untitled

@peteribrahimgorgy

This comment has been minimized.

Copy link

commented Feb 18, 2018

correct convert
showing value of 4760

image

@first-hero

This comment has been minimized.

Copy link

commented Feb 24, 2018

correct
int dollars = 40
int dollarsToYen = 119;
int yen = dollarsToYen * dollars;.............................40*119=4760
display(yen);........................=4760
screenshot_20180224-094848 1

@theiceman1010

This comment has been minimized.

Copy link

commented Mar 11, 2018

in the display method you have to have display(int + i)

and then .setText("" + i);

@mustangmert

This comment has been minimized.

Copy link

commented Mar 25, 2018

Could you please share the working xml and Main activity codes showing how you tried.
Thanks

@lakshmiprasannatirumala

This comment has been minimized.

Copy link

commented Mar 29, 2018

code is correct.
The output is 4760

@conbradst

This comment has been minimized.

Copy link

commented Apr 6, 2018

int dollars = 40;

    int dollarsToYen = 119;

    int yen = dollarsToYen * dollars;

    display(yen);

40 x 119 = 4760

  • Correct codes
@Imsurajkr

This comment has been minimized.

Copy link

commented Apr 15, 2018

int dollars = 40;
int dollarsToYen = 119;
int yen = dollarsToYen * dollars;
display(yen);

// After this code, you have to add
public void display(int i) {
TextView t = (TextView) findViewById(R.id.display_text_view);
t.setText("" + i);
}

@megaunknown

This comment has been minimized.

Copy link

commented May 17, 2018

The output is 4760

@Mohanad0

This comment has been minimized.

Copy link

commented May 26, 2018

1111
4760

@hero82

This comment has been minimized.

Copy link

commented Jun 1, 2018

int dollars = 40;
int dollarsToYen = 119;
int yen = dollarsToYen * dollars;
display(yen);
// After this code, you have to add
public void display(int i) {
TextView t = (TextView) findViewById(R.id.display_text_view);
t.setText("" + i);
}
whay i (int i)

@tooptooptoop

This comment has been minimized.

Copy link

commented Jun 2, 2018

correct :4760
a

@ahmedmtaher

This comment has been minimized.

Copy link

commented Jun 7, 2018

4760

@raDIUM2010

This comment has been minimized.

Copy link

commented Jun 12, 2018

4760

@jerylee

This comment has been minimized.

Copy link

commented Jun 26, 2018

image

@diegomenfer

This comment has been minimized.

Copy link

commented Oct 17, 2018

Hi @jerylee.
I tried to replicate what you did with your Layout, how do you get the .java to work with the layout?
cause when I changed the references to match the new ids in activity_main.xml, the application crashed, but without errors in Android Studio.
If could clarify that, I'll be grateful.

@josephmaayo

This comment has been minimized.

Copy link

commented Oct 31, 2018

this code also works fine:

    int dollars = 40;
    int dollarsToYen = 119;
    display (dollarsToYen * dollars);
@shaan0708

This comment has been minimized.

Copy link

commented Nov 23, 2018

Hii
I write the code correctly but i am getting the error in display
what should i do ?
screenshot 69 _li

@shankar-shiv

This comment has been minimized.

Copy link

commented Dec 23, 2018

@shaan0708 one of your closing braces are missing, check them!

@authentictech

This comment has been minimized.

Copy link

commented Mar 5, 2019

Kindly delete and do not post the answers to Udacity quizzes on these pages. It is not helpful to those who come here to get the code to see the answers before they have tried to answer the quiz for themselves.

The answer is provided on the next page in Udacity anyway - it is of no help to see it here. There is a Udacity forum to discuss the quiz if you need help.

I realize these are old posts but people are still doing the Udacity courses. The forum mods should remove the comments giving answers.

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.