PLEASE PROGRAMMING THIS ELECTRICTY BILL | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

PLEASE PROGRAMMING THIS ELECTRICTY BILL

I HAVE ATTACHED PLEASE LOOK IT!!! https://code.sololearn.com/cZjDgqHn29nc/?ref=app

1st Mar 2021, 7:28 PM
SHUBHAM SHARMA
SHUBHAM SHARMA - avatar
6 Answers
0
Btw what happens to your code if the user inputs other than the integer of your cases? Let's say 148 or 230? Maybe using switch is not the best solution here. Maybe you should try a condition with <= and >=
2nd Mar 2021, 8:18 AM
Cls
Cls - avatar
+ 1
Very thanks
2nd Mar 2021, 8:47 AM
SHUBHAM SHARMA
SHUBHAM SHARMA - avatar
0
Hello Shubham, 1/you've got some ; misplaced after your if 2/your main function should return tc, 3/you should put switch(u_n) and be careful, switch needs an integer
1st Mar 2021, 11:22 PM
Cls
Cls - avatar
0
Btw in CASE 150 you're doing (150*0.5+150*0.75) instead of (50*0.5+100*0.75)
1st Mar 2021, 11:49 PM
Cls
Cls - avatar
0
Why it is necessary to put integer in switch?
2nd Mar 2021, 1:33 AM
SHUBHAM SHARMA
SHUBHAM SHARMA - avatar
0
Because if you write switch('u_n') you are sending u_n as a character to case, and not its value (eg. 50, 150, etc.)
2nd Mar 2021, 7:35 AM
Cls
Cls - avatar