- 1
Write a java program that displays amount in rupees in terms of notes of different dominations.
For e.g Amount 1782 will be displayed as:: Rs 1000 notes : 1 Rs 500 notes : 1 Rs 100 notes : 2 Rs 50 notes : 1 Rs 20 notes : 1 Rs 10 notes : 1 Rs 5 notes : 0 Rs 2 notes : 1 Rs 1 notes : 0 :••Display all types of notes and number of times it falls according to the money entered by the user. Plz anyone solve this question .🙃
11 Antworten
+ 3
Abhishek Pandey you don't need more than 1 language. If you know Java, take Java. If you didn't understand what I meant here it is in Java.
I won't do full program but this should point you in the right direction:
Scanner sc = new Scanner(System.in);
int amount = sc.nextInt();
if(amount >= 1000)
{
int rs1000 = amount / 1000;
System.out.println("Rs 1000: " + rs1000);
amount -= rs1000 * 1000;
}
System.out.println("Remaining: "+ amount); // Continue with rs500
+ 1
Just think about how you got those numbers in the example and how you can express that strategy in code.
Start could be like this:
If amount > 1000:
rs1000 = amount / 1000 (integer division)
amount = amount - rs1000 * 1000
You could also use array or dictionary and go through the steps in a loop, but maybe like i wrote it with named variables and a lot of if statements is easier if you are a beginner
0
Hi! have you tried to solve it yourself?
0
No bro , actually i can't get how to do that.😞
0
Benjamin bro can u plz do the full program?🙁
0
This is not a place to come hire people to do your programming. You can try various freelancer websites to hire someone to write your app for you.
you must do your own attempt first, and then if needed you could search if there's still a topic about your problem (here, or on internet), and finally you could post here to request help on a specific question, with providing a link to your code playground and a useful description of the task you want to do and the problem you're facing...
0
Hmm u r true about that bro , but for me its challenging to solve any java programs because thats only language i learnt 😋. So even here if anyone posts any questions or even in discuss menu anyone posts some questions i would take it as a challenge n help the person to solve the program.
Which not at all mean that m hired
or something.🙃 If i can do the program doesn't matters to me that i did it fully right or not but i will do it if i can. And thats what i think abt all ppl here So i posted the question here bro.
I agree your point thats true.
But what abt dull students like me
who can't even get it how to solve than how could i even make my program n post here in the question?😞
0
thank you for such a detailed emotional response. but the maximum that I can help is to suggest a solution path, an algorithm, or something else, but I can't completely solve this problem, because I don't study java and haven't studied it in any way before. how do you post code here? write your program and save it in your code pad. copy the link to the code and place this link here
0
//You can do it like this:
Scanner sc = new Scanner(System.in);
int amt = sc.nextInt();
System.out.println("Rs 1000 notes:"+ ((amt/1000)(int)));
amt = amt%1000;
//....and so on.
- 1
Anyways thanks bro😀 i will try and post the code what i tried.
- 1
import java.util.Scanner; public class Program { public static void main( String[] args ) { float km, m, feet, inch, cm, yard; Scanner reader = new Scanner(System.in); System.out.print("\nEnter the distance between two cities(in km) : "); km = reader.nextFloat(); m = km * 1000; // 1km = 1000m feet = km * (float)3280.84; // 1km=3280.84feet inch = km * (float)39370.1; //1 km=39370.1inches cm = km * 100000; //1km = 100000cm yard = km * (float)1093.61; // 1km=1093.61yard System.out.print("\nDistance in Kilometres = " + m); System.out.print("\nDistance in Metres = " + m); System.out.print("\nDistance in Feets = " + feet); System.out.print("\nDistance in Inches = " + inch); System.out.print("\nDistance in Centimetres = " + cm); System.out.print("\nDistance in Yards = " + yard); } }