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..

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

ndeniche commented: Second time you're asking for homework? -1
sergent commented: second time out of 5 posts -1
Netcode commented: create java class in vb.net forum? -1

All 6 Replies

Have you even started coding any of it?

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

@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

Well, post your codes then, and lets see what we can do

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);
}
}
}

commented: c# code in vb.net forum causes confusion. -2

You sure this is your code?
Do you know this is the VB.Net section?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.