-3

good day!. i have a assignment given by my prof in vb.net subject,
but i cant program it well.. so, i need help also in equation and the codes..
please help me.

here,
Create a java class that will accept in coin(peso)
as integer input and will segregate it in the denomination of
100, 50,20,10,5,1

example.

if you enter:

input number: 126

Output:
100 - 1pc
50 - 0
20 - 1pc
10 - 0
5 - 1pc
1 - 1pc

Votes + Comments
create java class in vb.net forum?
second time out of 5 posts
Second time you're asking for homework?
4
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by GeekByChoiCe
0

you can take 100,50,20,10,5,1 in an array.
take 6 counters for each coin.
take i/p frm user and subtract the no. in array from i/p and increement the counter

0

@nichito, yes i have started it.. but when i try to enter 126, it appears in coloumn 100 = 0.

@armita, can you give the codes? just message me please.. i need it badly.. thanks

0

sorry for the late reply.
here is the code

import java.util.*;
import java.lang.*;

class Demo1
{
public static void main(String args[])
{
int a[]={100,50,20,10,5,1};
int amount;
int currency;
int i=0;
Scanner sc= new Scanner(System.in);
try
{
System.out.println("Enter the Number : ");
amount=sc.nextInt();
while(amount>0)
{
currency=amount/a;
if(currency!=0)
System.out.println(currency+"notes of"+a);
amount=amount%a;
i++;
}
}
catch(Exception E)
{
System.out.println(E);
}
}
}

Votes + Comments
c# code in vb.net forum causes confusion.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.