Thanks A.s. for Correcting my mistake | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Thanks A.s. for Correcting my mistake

can you give me your number a.s

24th Jul 2021, 2:31 PM
Tanay Rastogi
Tanay Rastogi - avatar
11 Answers
+ 1
s thanks you so much A.s.
24th Jul 2021, 4:39 PM
Tanay Rastogi
Tanay Rastogi - avatar
+ 1
Tanay Rastogi can u tell me char pc i didn't understood our words
25th Jul 2021, 6:27 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
in question there is saying use pc as in char
25th Jul 2021, 6:28 AM
Tanay Rastogi
Tanay Rastogi - avatar
+ 1
Tanay Rastogi can u tell little bit more what exactly u expecting
25th Jul 2021, 6:31 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
//Ques of the give program write a program to input product code (pc) in character, quantity of the product purchased (qty) and rate of 1 piece of product (rate ). calculate the total purchase amount and print it along with the gift to be presented on the following basis : Amount of purchase (Rs. ) gift to be present 200 and above but less than 700 a key chain 700 and above but less than 1200 a carry bag 1200 and above an electronic cal culator //thank you A.s I was giving only one input that's why my program is not working.. thanks for correcting me to give 3 inputs to compiler. thaks A.s
25th Jul 2021, 6:38 AM
Tanay Rastogi
Tanay Rastogi - avatar
+ 1
Tanay Rastogi 😝👍
25th Jul 2021, 6:40 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
can you give me your number
25th Jul 2021, 6:41 AM
Tanay Rastogi
Tanay Rastogi - avatar
0
import java.util.*; class l { public static void main (String[]args) { Scanner sc=new Scanner (System.in); System.out.println ("Enter product code"); char pc =sc.next().charAt(0); System.out.println ("Enter quantity of the product purchase"); int qty =sc.nextInt(); System.out.println ("Enter rate of one piece of product"); int rate=sc.nextInt(); int a=qty*rate; System.out.println("Amount="+a); if(a>=200 && a<700) { System.out.println ("A key chain"); } else if (a>=700 && a<1200) { System.out.println("A carry bag"); } else if(a>=1200) { System.out.println("An electric calculator"); } } }// check where is error in this program
24th Jul 2021, 2:32 PM
Tanay Rastogi
Tanay Rastogi - avatar
0
Tanay Rastogi Your code is incomplete. Make code in Code Playground and share the link with your question.
24th Jul 2021, 3:13 PM
A͢J
A͢J - avatar
0
Tanay Rastogi your code is working if u trying on sololearn plateform then u need to give all input's at same time i tried its working without any error your program requires three inputs
24th Jul 2021, 4:37 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Tanay Rastogi why u take char PC? As there is no use of it :/
25th Jul 2021, 5:58 AM
Shahid Iqbal
Shahid Iqbal - avatar