3rd Feb 2022, 11:35 AM
Techno Team
29 Respostas
+ 1
https://code.sololearn.com/cG8ZOzrEWj5W/?ref=app
3rd Feb 2022, 12:02 PM
Techno Team
+ 1
Assign value to amt Or use scanner to input value.. Ex:use this line, int amt = 20000; edit: Techno Team use this above line, instead of int amt;
3rd Feb 2022, 11:42 AM
Jayakrishna 🇮🇳
+ 1
May u do it correct in my code
3rd Feb 2022, 11:43 AM
Techno Team
+ 1
I'm unable to get it
3rd Feb 2022, 11:43 AM
Techno Team
+ 1
Do help
3rd Feb 2022, 11:48 AM
Techno Team
+ 1
No output is coming
3rd Feb 2022, 11:56 AM
Techno Team
+ 1
import java.util.Scanner; public class Discount { public static void main (String[] args) { Scanner in = new Scanner(System.in); int amt = in.nextInt(); double dis; if(amt<=2000) dis=0.025; else if(amt>=2001&&amt<=4000) dis=0.04*amt; else if(amt>=4001&&amt<=7000) dis=0.07*amt; else dis=0.10*amt; System.out.println("Your purchase is "+amt+" so your discount is "+dis+" Thanks for shopping"); } } //Techno Team you forgot to add static to main method:
3rd Feb 2022, 12:01 PM
Jayakrishna 🇮🇳
+ 1
Help here too
3rd Feb 2022, 12:02 PM
Techno Team
+ 1
Line no:5 remove '{' and add it in place of ';' in line no:3 Changes needed, Remaining all are same as your last program. take input to amt;
3rd Feb 2022, 12:08 PM
Jayakrishna 🇮🇳
+ 1
May u do the same u did above
3rd Feb 2022, 12:09 PM
Techno Team
+ 1
That's 7 min ago
3rd Feb 2022, 12:09 PM
Techno Team
+ 1
I said what changes you need. You should try now...! Happy learning. ..
3rd Feb 2022, 12:11 PM
Jayakrishna 🇮🇳
0
public static void main(String[] args) { int amt; double dis; Scanner sc = new Scanner(System.in); amt = sc.nextInt(); if(amt<=2000) // …
3rd Feb 2022, 11:50 AM
JaScript
JaScript - avatar
0
Like i have to write scanner class too
3rd Feb 2022, 12:11 PM
Techno Team
0
If you want to take input, then use scanner class. Otherwise manually do like int amt = 20000; (before, Read last 4mins ago post, first)
3rd Feb 2022, 12:14 PM
Jayakrishna 🇮🇳
0
Oky
3rd Feb 2022, 12:15 PM
Techno Team
0
I'm doing and if i can't do give me some more hints
3rd Feb 2022, 12:15 PM
Techno Team
0
Notify with updated code..
3rd Feb 2022, 12:17 PM
Jayakrishna 🇮🇳
3rd Feb 2022, 12:18 PM
Techno Team
0
Check this out
3rd Feb 2022, 12:18 PM
Techno Team