6 Replies - 382 Views - Last Post: 16 February 2017 - 11:30 AM Rate Topic: -----

#1 solider1998   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-February 17

Help needed with Java homework

Posted 16 February 2017 - 10:33 AM

I need help with java homework. The problem is that i have no idea how to write the code. I have been at it for 2 days and still have no clue and time is running out. Any help is appreciated. The program is supposed to be the following:

The cash register has the following bills: 1x 20eur, 2x 10eur, 3x 5 eur,1x 2eur, 1x 1eur. The program asks: „how large is the change:“ .If the change is too large, then: „There isnt enough change". If it isnt possible to give out an exact change (for example: 24 eur), then „Its not possible to give exact change". But if there is enough change (lets say 37 eur) then the program should say like this:
„The change is:
20 eur: 1x
10 eur: 1x
5 eur: 1x
2 eur: 1x

Is This A Good Question/Topic? 0
  • +

Replies To: Help needed with Java homework

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14155
  • View blog
  • Posts: 56,742
  • Joined: 12-June 08

Re: Help needed with Java homework

Posted 16 February 2017 - 10:35 AM

What have you tried, attempted, or thought about?

At the bare bones I would hope outputting text, getting a value in, and some variables, right?
Was This Post Helpful? 0
  • +
  • -

#3 solider1998   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-February 17

Re: Help needed with Java homework

Posted 16 February 2017 - 10:41 AM

View Postmodi123_1, on 16 February 2017 - 10:35 AM, said:

What have you tried, attempted, or thought about?

At the bare bones I would hope outputting text, getting a value in, and some variables, right?


Sadly i have nothing. Lately i have been sick and been studying for my other classes... a lot(i was sick for a month and at that time period i just didnt have the wellbeing and strength to do any studying). I have no idea where and how to start with the code.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14155
  • View blog
  • Posts: 56,742
  • Joined: 12-June 08

Re: Help needed with Java homework

Posted 16 February 2017 - 10:45 AM

Okay then start at the beginning. The homework requires the app to ask a question - aka output text to the screen. Get that done. Presumably it wants input so get that done. Those should be fairly straight forward things to accomplish.

Then look at the 'register'... I am thinking variables for those bills should work. Get hopping on making those.
Was This Post Helpful? 0
  • +
  • -

#5 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1467
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Help needed with Java homework

Posted 16 February 2017 - 10:51 AM

Well first identify variables like

1x 20eur, 2x 10eur, 3x 5 eur,1x 2eur, 1x 1eur.

translates to

int eur20 = 1;
int eur10 = 2;
int eur5 = 3;
etc

take some input through the Scanner

http://docs.oracle.c...il/Scanner.html

into a variable called int change; for example

Scanner sc = new Scanner(System.in);
int change = sc.nextInt();




Then compare what you have in the register and see if you can make the change that part is just math or were you also sick for that part too ?
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14155
  • View blog
  • Posts: 56,742
  • Joined: 12-June 08

Re: Help needed with Java homework

Posted 16 February 2017 - 10:52 AM

Well.. cooooooooould have helped walk through the basics since OP hasn't even gotten that far yet. ;) :^:
Was This Post Helpful? 0
  • +
  • -

#7 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1467
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Help needed with Java homework

Posted 16 February 2017 - 11:30 AM

Well I showed how to declare an int that's pretty basic ?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1