Practice Set on Errors & Exceptions

Поділитися
Вставка
  • Опубліковано 17 гру 2024

КОМЕНТАРІ • 332

  • @MUKESH-hr5ux
    @MUKESH-hr5ux 4 роки тому +30

    Harry Bro👍 your great men in this Earth coders journey Because of you, we coders are getting to learn a lot.god always blessings you....🙏🙏🙏🙏🙏🙏🙏

    • @Superak07
      @Superak07 2 роки тому +3

      tum log kya har videos mai yehi likte ho ya kuch padte bhi ho?

  • @Q00997
    @Q00997 4 роки тому +9

    I appreciate you for making coding easier for me!!!

  • @anshdholakia714
    @anshdholakia714 3 роки тому +53

    For Question 4 ->
    Make a custom class for the error ->
    class Exceptiononretry extends Exception{
    @Override
    public String getMessage(){
    return "Error";
    }
    }
    In the main function->
    if(i>=5){
    try{
    throw new Exceptiononretry();
    }
    catch(Exceptiononretry e){
    System.out.println("
    "+e.getMessage());
    }
    }
    For question 5 ->
    Using the above custom class make this function->
    public static void throwexception(int i) throws Exceptiononretry{
    if (i
    if(i>=5){
    try{
    throwexception(i);
    }
    catch(Exceptiononretry e){
    System.out.println("
    "+e.getMessage());
    }
    }

    • @sandhyarajkumar8597
      @sandhyarajkumar8597 2 роки тому +3

      Thanks..! It helped me a lot....🤗

    • @mkssingh8747
      @mkssingh8747 2 роки тому +2

      Thanks bro ❤❤❤

    • @nainagupta4949
      @nainagupta4949 Рік тому +1

      one question why do you extend Exception class ? what is the need I am bit confuse cant we do without extend ?

    • @DineshKarthikChiluka
      @DineshKarthikChiluka Рік тому

      @@nainagupta4949 then only you can create a custom exception class, inshort creating a subclass from a parent class(Exception) which is in-built.

    • @Ece-hj4rn
      @Ece-hj4rn 5 місяців тому

      @@nainagupta4949 to write a custom exception class you need to extend it from exception class.

  • @amikoss5635
    @amikoss5635 Рік тому +9

    Problem #3 can be done this way;
    /* Problem 3
    // Write a program that allows you to keep accessing elements of an array until a valid index is given. If max retries exceed 5, print "Error".
    int [] marks = new int[5];
    marks[0] = 50;
    marks[1] = 70;
    marks[2] = 100;
    marks[3] = 90;
    marks[4] = 10;

    Scanner sc = new Scanner(System.in);
    boolean flag = true;

    while (flag){
    System.out.print("Enter valid array index: ");
    int user_input = sc.nextInt();
    try {
    System.out.println(marks[user_input]);
    }
    catch (ArrayIndexOutOfBoundsException e){
    System.out.println("ERROR!");
    flag = false;
    }
    }
    System.out.println("Thanks for using this program!");
    */
    It makes more sense!

    • @sonalidhar4347
      @sonalidhar4347 7 місяців тому +2

      You haven't understood the qs.
      Qs me index as an input Galt (jo index out of bound) dalneka 5 max mauka deta hai....agr in 5 mauke Mei koi sahi index Dal deta hai to program exit hona chahiye Matlab further input nehi mangega program and agr sahi index dalneki kosis 5 ke upr jata hai to error show hona chahiye.

  • @himankjeshwar8636
    @himankjeshwar8636 2 роки тому +17

    12:09 - Solution given below:
    // Problem 4 and 5
    import java.util.Scanner;
    class MaxRetriesExceededException extends Exception{
    @Override
    public String toString(){
    return "
    MaxRetriesExceededException: "+getMessage();
    }
    @Override
    public String getMessage(){
    return "You have exceeded the maximum limit of 5 attempts to access the array.";
    }
    }
    public class PS_03_KeepAccessingAnArray {
    static void accessArray()throws MaxRetriesExceededException{
    // declaration
    int index,c = 1;
    String [] vegetables = {"Potato","Garlic","Ginger","Tomato","Onion"};
    boolean isIndexValid;
    do {
    Scanner sc = new Scanner(System.in);
    System.out.print("Enter an index number - ");
    index = sc.nextInt();
    try{
    System.out.print("Element at index "+index+" - "+vegetables[index]);
    isIndexValid = true;
    sc.close();
    }
    catch(ArrayIndexOutOfBoundsException e){
    System.out.println("Invalid Index.
    \tTry again");
    isIndexValid = false;
    }
    if (isIndexValid==true)
    break;
    else if(c==5){
    sc.close();
    throw new MaxRetriesExceededException();
    }
    c++;

    }while(c

  • @NaviSaroha
    @NaviSaroha 4 роки тому +5

    Harry bhai, wish u aap ache hoge or kush honge apni life me
    Bhai me aapki webdevlopment vaali series sikh rha tha tb merko ek idea aaya bhot exclusive h m vo apse discuss krna chata hu hope vo apko psnd aaye.?
    M apke rply ka wait krunga thank you..

  • @jaythakur978
    @jaythakur978 3 роки тому +4

    Problem 4-
    if(i>=5){
    System.out.println("Error");
    try{
    throw new MaxRetriesException();
    }
    catch(Exception e){
    System.out.println("Exception:"+e);
    }
    }

  • @harsimran.27
    @harsimran.27 4 роки тому +14

    HARRY BHAI ABHI JAVA COLLECTION FRAMEWORK TAK PAUCHNE K LIYE KITNE VIDEOS LGENGEY ?
    class maxRetries extends Exception{
    @Override
    public String getMessage() {
    return "Max Retries reached";
    }
    @Override
    public String toString() {
    return "5 Retries";
    }
    }
    try {
    if (i>=5){
    throw new maxRetries();
    }
    }
    catch (maxRetries m){
    System.out.println(m);
    System.out.println(m.getMessage());
    }

  • @satvikmittal4487
    @satvikmittal4487 4 роки тому +11

    EXCEPTION CLASS:
    class MaxRetriesException extends Exception{
    @Override
    public String toString() {
    return "Max Retries Error";
    }
    @Override
    public String getMessage() {
    return "You have reached max tries,you cannot proceed further";
    }
    }
    Method:
    public static void getArrayElementUntilLimitReached() throws MaxRetriesException{
    //Problem 3-:
    int []arr={1,2,3};
    int i;
    int index;
    Scanner sc=new Scanner(System.in);
    for(i=1;i

  • @vishalkumar-xl6mb
    @vishalkumar-xl6mb 2 роки тому +1

    this course is very nice sir. I understand every thing very easily.

  • @gamexd3228
    @gamexd3228 4 роки тому +12

    Harry Bhai !!! Why You Stopped Making Videos on DSA

  • @biswajeet9826
    @biswajeet9826 3 місяці тому

    Bahut sahi kaam kar rahe ho bhai!

  • @FSIF-gb7vc
    @FSIF-gb7vc 2 роки тому +2

    12:36
    class MyOwnException extends Exception{
    @Override
    public String toString() {
    return "Invalid Input";
    }
    @Override
    public String getMessage() {
    return "Error";
    }
    }
    public class HybridCalculator {
    public static void main(String[] args){
    java.util.Scanner sc = new java.util.Scanner(System.in);
    int j = 0;
    int[] arr = new int[5];
    arr[0] = 1;
    arr[1] = 2;
    arr[2] = 3;
    arr[3] = 4;
    arr[4] = 5;
    while (j= arr.length) {
    try {
    throw new MyOwnException();
    } catch (Exception e) {
    System.out.println(e.toString());
    j++;
    if (j == 5) {
    System.out.println(e.getMessage());
    }
    }
    } else System.out.println(arr[n]);
    }
    }
    }

    • @kaleemashraf2325
      @kaleemashraf2325 Рік тому

      If you throw MyOwnException class in try block than what about if the user input index is right?? It throws only exceptions not correct values see

  • @hreedaymishra7761
    @hreedaymishra7761 4 роки тому +2

    Please make a video on functional programming , procedural programming and object oriented programming and their difference......

  • @hoholord5699
    @hoholord5699 4 роки тому +1

    I hope u cross million subs❤️

  • @anshuldhok3407
    @anshuldhok3407 3 роки тому +2

    Can you please upload all the handwritten notes at one place other than that all things are awesome 👏👍

  • @mysterynights6255
    @mysterynights6255 4 роки тому +22

    Sir will u teach complete data structure and algorithm in java

  • @abhinavrathore3016
    @abhinavrathore3016 3 роки тому +12

    Question -4
    import java.util.*;
    class Q_3{

    public static void main(String args[]){
    Scanner in = new Scanner(System.in);
    int a[]=new int[5];
    a[0]=0;
    a[1]=1;
    a[2]=2;
    a[3]=3;
    a[4]=4;
    int i=1;

    while(true){
    System.out.println("Enter index ");
    int b=in.nextInt();
    if(i

  • @vedantpawar387
    @vedantpawar387 4 роки тому +2

    Thoda sa wait aur 1million subs

  • @Q00997
    @Q00997 4 роки тому +2

    Thank you Harry bhai , You are the best programmer in the world and you explain clearly all the stuff in the coding.

  • @tanveershaikh8374
    @tanveershaikh8374 2 роки тому

    Hatts off Harry bhai🤗

  • @theautumnleaves343
    @theautumnleaves343 4 роки тому +1

    1M soon🦄

  • @nikhilchouhan3010
    @nikhilchouhan3010 4 роки тому +2

    Harry bhai app ak teligram group banao jisme hum sab discussion krenge

  • @AnkitKumar-lb6vi
    @AnkitKumar-lb6vi 2 роки тому

    // Sir actually i start my coding journey 3 months before and this is first time i solve a question by myself.
    //I can't able to believe ! This is so amazing feeling.
    // Thank You sir , Thankyou so much...
    // Haa aasan aasan Qs. toh solve ho jate hai , Logic wala ye pahla tha .
    /*(Q3) Write a program that allows you to keep accessing an array until a valid index is given .
    If max retries exceed 5 , print "Error".
    */
    import java.util.Scanner;
    public class vn87_PracticeSet14
    {
    public static void main(String[] args)
    {
    int [] Sahiba = new int[5];
    Sahiba[0]=5;
    Sahiba[1]=6;
    Sahiba[2]=58;
    Sahiba[3]=48;
    Sahiba[4]=16;

    System.out.println("LOVE IS BEAUTIFUL THINGS FOUND IN NATURE EVER.");
    int i=0;
    while(i4)
    {
    System.out.println("You crossed the limit of 5 inputs");
    System.out.println("Error");
    }
    }

    }
    }

  • @websiteworld4473
    @websiteworld4473 4 роки тому +2

    Sorry for asking in this video. I completed 61 video out of 103 in your web development playlist everything going smoothly no issue. But i want to know that after this course kya main website bna paaunga.. please reply...
    N thank you for uploading these amazing playlist on coding n programming. Basically i m a commerce student but i love these things so i started your course. Ang thnk uh. N love you bro keep it up

  • @letsgetcopyright2603
    @letsgetcopyright2603 3 роки тому

    Upload all series for everyone .
    Bhai ma pakistani hon but ek na ek din ma ap sy milny zaroor aayon ga.
    Mera nam yad rakhna ma atleast 10 sal bad milon ga.
    Love you bro jo kr rahy ho karty raho.
    OR ye comment ma ap ki har video ma kron ga kisi ma tu reply aay ga na..

  • @charchitdahiya986
    @charchitdahiya986 4 роки тому +1

    Sir ek video is par bhi bna do ki aap ne coding ki starting kaise ki , you are legend from many of us and we will get to know something.

  • @SUPERHEROSTUD10S
    @SUPERHEROSTUD10S 4 роки тому

    Big fans sir plz upload how to crack password and on mobile or PC camera by using python plz sir plz🙏🙏🙏

  • @janhvinarayan1633
    @janhvinarayan1633 4 місяці тому +1

    class MaxTriesReachedException extends Exception{
    @Override
    public String toString() {
    System.out.println("Error");
    return "Tries can't be >5";
    }
    public String getMessage(){
    return "Make sure entered index is correct.";
    }
    }
    if(t>=5){
    throw new MaxTriesReachedException();
    }

  • @rajatchaurasia3578
    @rajatchaurasia3578 3 роки тому +1

    Present sir 👌🏻❤❤👌🏻❤👌🏻👌🏻❤❤👌🏻

  • @gulafshakhanam7801
    @gulafshakhanam7801 4 роки тому +2

    Sir, please make a tutorial on a project in java

  • @anshumansharma6650
    @anshumansharma6650 3 роки тому

    Love You harry Bhai❤❤❤❤.

  • @Vikas-vy4vs
    @Vikas-vy4vs 4 роки тому +4

    When finish java course? How many chapters left?

  • @VijayKumar-eq9pl
    @VijayKumar-eq9pl 4 роки тому +1

    Sir, please make a playlist on OPENCV in Python,please ,please ,please.

  • @SaM-gq8cf
    @SaM-gq8cf Рік тому +1

    12:00 - Solution Of Question Number 5
    import java.util.Scanner;
    class Prints_an_Exception extends Exception {
    @Override
    public String toString() {
    return "Error! Index is out of bound...";
    }
    @Override
    public String getMessage() {
    return "Error occured!";
    }
    }
    public class PrintTheException{
    public static int funtion(int val ) throws Prints_an_Exception{
    if (val>5){
    throw new Prints_an_Exception();
    }
    return val;
    }
    public static void main(String[] args) {
    int[] arr = {10, 20, 30, 40, 50};
    boolean flag=true;
    Scanner sc = new Scanner (System.in);
    int val;
    int i=0;
    while(flag && i

  • @rukminisingh8493
    @rukminisingh8493 4 роки тому

    Sir please bring Series of C# because it help alot

  • @ramphapal6610
    @ramphapal6610 Рік тому

    Harry bhai yar your teaching so helpful to me. THANK YOU.
    import java.util.*;
    class MaxRetriesException extends Exception{
    public String toString(){
    return "max retries is not allowed";
    }
    }
    public class cwh_86_pc14 {
    public static void main(String[] args)throws MaxRetriesException
    {
    // try {
    // int a = 8;
    // int b = 0;
    // int c = a / b;
    // }
    // catch(ArithmeticException e){
    // System.out.println("HaHa");
    // }
    // catch(IllegalArgumentException e){
    // System.out.println("Hehe");
    // }
    //problem 3
    boolean flag = true;
    int marks[] = new int[3];
    marks[0] = 2;
    marks[1] = 3;
    marks[2] = 4;
    int i=0;
    while(flag && i= 5){
    throw new MaxRetriesException();
    //System.out.println("Error");
    }
    }
    }

  • @gkanything9567
    @gkanything9567 3 роки тому

    Thanks a lot sir 🔥 🔥 🔥

  • @imgullu
    @imgullu 8 місяців тому

    Time Stamp - 5:43
    // Question - 3
    // This will throw ArithmeticException when k is even and IllegalArgumentException when k is odd.
    // Manually you can change the value of k to check the output.
    public class javaSolution {
    public static void main(String[] args) {
    int k = 5;
    try {
    if (k%2 == 0){
    int result = 10/0;
    } else {
    throw new IllegalArgumentException();
    }
    } catch (ArithmeticException e){
    System.out.println("Haha");
    } catch (IllegalArgumentException e){
    System.out.println("Hihi");
    }
    }
    }

  • @mhruploads
    @mhruploads 4 роки тому +1

    Bro java Applet or awt controls pr video bnaao

  • @wowlollipop3434
    @wowlollipop3434 3 роки тому +1

    Bro kya html or css sa android app develop kar sak ta hai please reply .

  • @dnyaneshwarigund9616
    @dnyaneshwarigund9616 2 роки тому +2

    12:09 -Solution as given below;
    // Custom Exception
    class MaxRetries extends Exception{
    @Override
    public String toString() {
    return "Max Retries Attempts to Access the variable!";
    }
    public static void throwMaxRetriesException(int count) throws MaxRetries{
    if(count==5){
    throw new MaxRetries();
    }
    }
    }
    // In main method:
    int [] arr={1,2,3,4,5,6,7,8,9,10};
    int index,count=0;
    Scanner scan = new Scanner(System.in);
    boolean flags=true;
    while(flags && count

  • @zubairali1265
    @zubairali1265 Рік тому +1

    Harry bhai problem 3 ki while loop m agr flag n use kre to bi program shi se run ho rha h to flag k kya rule h

  • @aahutoshdwivedi6154
    @aahutoshdwivedi6154 Рік тому

    Thank you sir ji

  • @w.intelli7721
    @w.intelli7721 3 роки тому

    Thank you harry bhai

  • @Anwarumar
    @Anwarumar 4 роки тому +1

    Those who are happy for this course like plz 😜😜😜😜😜

  • @m.hunainh.h5838
    @m.hunainh.h5838 4 роки тому

    sir please typing speed tezz karna par aik video banady.....

  • @RaghavRoy-vo4jd
    @RaghavRoy-vo4jd 4 роки тому +1

    plz make one vedios for commers students how to make a software engineer
    plz bahiya plz

  • @sunilkumarsingh7411
    @sunilkumarsingh7411 4 роки тому

    Harry bhai will you plz make flutter tutorials playlist

  • @mohammadfaizanhashmi4213
    @mohammadfaizanhashmi4213 3 роки тому

    wah harry ji wah

  • @arnimavashishtha2271
    @arnimavashishtha2271 4 роки тому +2

    How many more videos will be there in this course?

  • @MizanurRahaman03
    @MizanurRahaman03 2 роки тому

    class MaxRetry extends Exception{
    @Override
    public String toString() {
    return "Max retry exhaust";
    }
    @Override
    public String getMessage() {
    return "You try to many wrong , your max retries exhaust...";
    }
    }

  • @shaileshhacker
    @shaileshhacker 3 роки тому

    Thank You

  • @HARWINDERSINGH-rq2om
    @HARWINDERSINGH-rq2om 4 роки тому

    Please make a video on python kivy and kivy languages for mobile application

  • @areeb8197
    @areeb8197 4 роки тому

    Thanks bro you are awsome your videos are soo helpful

  • @Vikas-vy4vs
    @Vikas-vy4vs 3 роки тому +3

    How much syllabus left in this courses? 4 months go.

  • @prathamkapania1788
    @prathamkapania1788 4 роки тому

    Harry Bhai, abhh toh MEAN OR MERN par videos upload krdoh

  • @AdityaDeveloper_
    @AdityaDeveloper_ Рік тому

    class MaxRetry extends Exception{
    @Override
    public String toString() {
    return super.toString();
    }
    @Override
    public String getMessage() {
    return "Index out of Bound";
    }
    }
    ---> In main method
    if (i>=5){
    try {
    throw new MaxRetry();
    }
    catch (Exception e){
    System.out.println(e.getMessage());
    }

  • @casafurix
    @casafurix 2 роки тому

    hmm nice, 6/9

  • @mdmufidalam3757
    @mdmufidalam3757 Рік тому

    harry bhai please make a tutorial video on dsa in java

  • @Aish-dm4np
    @Aish-dm4np 3 роки тому

    Pls SQL padhai dijiye Harry Ji

  • @aryanworldwide24
    @aryanworldwide24 4 роки тому +1

    nice video sir

  • @apnabollywood5712
    @apnabollywood5712 4 роки тому

    Harry bhai Ethical hacking ke roadmap par video banao
    *please*

  • @sejalsihare6360
    @sejalsihare6360 4 роки тому +1

    Sir your videos are too good,right now i am learning C language from your videos

  • @ayushshah2464
    @ayushshah2464 4 роки тому

    Thank u harry bhai for efforts

  • @atulyadav7308
    @atulyadav7308 4 роки тому

    Harry bhai database pr video banao na

  • @RohanDasRD
    @RohanDasRD 4 роки тому

    Awesome bhai

  • @krishkhemani96
    @krishkhemani96 3 роки тому +1

    Can some1 explain me why did we use flag in problem 3 even without flag we can only use indes for 5 times then what was its use!????

    • @tharunkumar7743
      @tharunkumar7743 3 роки тому

      We can also specify like this....
      //This should be used In while loop//
      if(i

  • @saifurrahmanudoy
    @saifurrahmanudoy 4 роки тому +1

    Hi Harry bhaia! I want to talk to you, brother , please , bhai , I understand all the concepts of Python programming but can't be solved if you give Python programming QUIZ / Exercise 😭😭😭 , What shall I do, brother? Please help 🥺.

  • @chinmaydeshpande5046
    @chinmaydeshpande5046 4 роки тому

    Harry bhai op 🔥🔥🔥🔥

  • @ayushkumar2310
    @ayushkumar2310 3 роки тому +1

    If you provide 'a' as an input in "Q3" , then the programme not run properly . Why it is So ? I Hope anybody will answer it .

  • @kapilrana4043
    @kapilrana4043 3 роки тому +23

    Problem 4
    class RetryException extends Exception{
    public String toString(){
    return "Error";
    }
    public String getMessage(){
    return "Error";
    }
    }
    public class cwh_86_ps14 {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a[] = new int[5];
    a[0] = 0;
    a[1] = 1;
    a[2] = 2;
    a[3] = 3;
    a[4] = 4;
    int i = 1;
    while (true) {
    System.out.println("Enter the value of your index");
    int b = sc.nextInt();
    if (i < 6) {
    try {
    System.out.println("Your value" + a[b]);
    } catch (ArrayIndexOutOfBoundsException e) {
    i++;
    System.out.println("You have crossed limit" + i);
    }
    }
    else {
    try {
    throw new RetryException();
    } catch (Exception e) {
    System.out.println(e.getMessage());
    }
    }
    }
    }
    }

    • @johnwilkesbooth8000
      @johnwilkesbooth8000 3 роки тому

      kapil rana Bhai break method kyo nahi lagaya 6 number ko cross karne ke baad null bata raha hai lekin program se out nahi ho pa raha kya kar sakte hai????

    • @khansaibaz8191
      @khansaibaz8191 3 роки тому

      Bro you add break in else conditions also
      Because while loops continue execute

  • @PrinsTripathi99
    @PrinsTripathi99 4 роки тому

    very good video

  • @ari995
    @ari995 4 роки тому +1

    bhai mujhe rust programming language sikhna he kya app sikhaoge pls.

  • @pie2790
    @pie2790 2 роки тому

    in q3)whats the use of flag variable???
    package CORE;
    import java.util.Scanner;
    public class PSErrors {
    public static void main(String[] args) {
    int [] arr=new int[3];
    arr[0]=78;
    arr[1]=22;
    arr[2]=89;
    int i=0;
    Scanner sc=new Scanner(System.in);
    while(i=5){
    System.out.println("ERROR :NO of attempts exceeded 5");}
    }
    }

  • @vivekrajput7805
    @vivekrajput7805 4 роки тому

    bhai dart pr bi course bnao pllz

  • @voiceoflove1427
    @voiceoflove1427 4 роки тому

    Sr ma android app download krta hn or hr bar stroge kam bta ha kuion please help me how many requirements stroge for download please🙏🙏🙏🙏🙏🙏🙏

  • @GamerboyhitarthOG
    @GamerboyhitarthOG 4 роки тому +1

    sir please complete the django serise please

  • @nitintech3674
    @nitintech3674 4 роки тому

    Hey harry bhai I am your big fan please make one video on turtle module in python

  • @MillandeepSingh
    @MillandeepSingh 3 роки тому

    please koi explain kr do illegal argument exception hota kya haa aur vo exception occur krane ke liye iss wale program me kya arguments pass krani haa

    • @cognosagedev
      @cognosagedev 3 роки тому

      agar ap argument me int type do kisi method k per jab ap ka user String value enter ker de to usko handle karny k liay illegalArgumentException use hoti hy

  • @yogirajpatil1872
    @yogirajpatil1872 4 роки тому +5

    Please go with collection framework

    • @chhatrashihpatil7313
      @chhatrashihpatil7313 4 роки тому +4

      It's true go with collection Framework also it damm difficult for me also to understand. Please

    • @rohitpinjar5991
      @rohitpinjar5991 4 роки тому +4

      Harry bhai please go with Java framework also

    • @sauravpatil541
      @sauravpatil541 4 роки тому +3

      Please sir go with collection Framework.

    • @vaijnathjyotirling1829
      @vaijnathjyotirling1829 4 роки тому +2

      Yes bro it's appreciated if you go with collection framework

  • @codinglife534
    @codinglife534 4 роки тому

    Harry bhai make videos on odoo

  • @vitthalgorade1433
    @vitthalgorade1433 4 роки тому +1

    Harry bhai will soon reach 1 million subscribers
    Who want Harry bhai to come live on UA-cam

  • @allino1957
    @allino1957 4 роки тому

    inp = input("enter code for crit")
    if inp=="A":
    code = input(" Please enter the option code for dish you would like to order (e.g. s1)
    ")
    file = open("alltime.txt", "r")
    total_cost = 0
    # print(file.read())
    while code != "done":
    for line in file:
    data = line.split("-")
    itemCode = data[0]
    itemDescription = data[1]
    itemPrice = float(data[2])
    if itemCode == code:
    print(itemCode+" - "+itemDescription+" - "+str(itemPrice))
    total_cost = total_cost + itemPrice
    code = input("enter code for more order or enter done for exit
    ")
    print("total cost of your order is ", total_cost)
    print('thank you for ordering here')
    file.close()
    when I type "done" it gives : IndexError: list index out of range
    what should I do please help me with this

  • @umangsharma20
    @umangsharma20 4 роки тому +1

    Sir DART LANGUAGE ke lie bhi kuch btao....

  • @lucknomics7095
    @lucknomics7095 2 роки тому

    Ismai flag variable agr na use krein to bhi chalega

  • @joneroy4996
    @joneroy4996 4 роки тому

    Bhaiya mera gameing app mai kuch user hai jo ki kuch trick karke high score karta hai uska account ko block or unblock kaise kare.. ???video dene se acha hoga.. 🙏🙏

  • @shivanshutyagi83
    @shivanshutyagi83 4 роки тому

    Harry bhai 👋👋

  • @CRAZYGAMING-qg2kb
    @CRAZYGAMING-qg2kb 4 роки тому

    Hello bro! are u able to upload the video of 3d game development

  • @vishalkumar-xl6mb
    @vishalkumar-xl6mb 2 роки тому

    sir notes are not downloading after video no. 79. and chapter 14's practice set also not downloading please check it.

  • @abhinavrathore3016
    @abhinavrathore3016 3 роки тому

    Question-2
    import java.util.*;
    class Q_2{

    public static void main(String arg[]){
    int a;
    Scanner in = new Scanner(System.in);
    try{
    System.out.println("Enter value");
    a=in.nextInt();
    System.out.println("Result :"+a/0);
    }
    catch(IllegalArgumentException e){
    System.out.println("HaHa");
    }
    catch(ArithmeticException e){
    System.out.println("HeHe");
    }
    catch(InputMismatchException e){
    System.out.println(" Hey i am illegal");
    }
    }
    }

  • @balboa7
    @balboa7 2 роки тому +2

    Problem 5
    I have tried this problem by other approach. Please give me some suggestions on how to enhance it and make it better ....
    package com.company;
    import java.util.Scanner;
    class maxRetriesException1 extends Exception{
    @Override
    public String getMessage() {
    return "Error";
    }
    @Override
    public String toString() {
    return "Error";
    }
    }
    public class L86_Ch14_PS_Q5 {
    public static void validArray(int i) throws maxRetriesException1{
    if(i>=5){
    throw new maxRetriesException1();
    }
    }
    public static void main(String[] args) {
    boolean flag = true;
    int [] a = {56, 98, 51};
    int ind;
    Scanner sc = new Scanner(System.in);
    int i = 0;
    while(flag && i

    • @pie2790
      @pie2790 2 роки тому

      why have you used flag?? while(i

  • @tusharkhurana2433
    @tusharkhurana2433 2 роки тому

    for question no. ->
    class maxIndex extends Exception
    {
    @Override
    public String toString() {
    return "error";
    }
    }
    public class Adi {
    public static void main(String[] args) {
    // Problem 3
    boolean flag = true;
    int [] marks = new int[3];
    marks[0] = 7;
    marks[1] = 56;
    marks[2] = 6;
    Scanner Sc = new Scanner(System.in);
    int index;
    int i = 0;
    while(flag && i=5){
    try {
    throw new maxIndex();
    } catch (Exception e)
    {
    System.out.println(e);
    }
    }
    }
    }

  • @YTHelper
    @YTHelper 4 роки тому +1

    Akhilesh Yadav 2GB RAM wala laptop maximum kis limit tak upgrade kar sakte

  • @prayagpatel5911
    @prayagpatel5911 4 роки тому +5

    Please sir start ethical hacking course

  • @harshdeepsingh9324
    @harshdeepsingh9324 4 роки тому

    Please tell how to change language of pyttsx3 in python,
    I want to change language of my Jarvis

  • @anuj1539
    @anuj1539 4 роки тому +1

    i have been following you since 1 year , harry bhai aap apne baare me kuch to batao , like your real name , bckground
    Hum sabko to yehi lagta hai ek Gora Chita banda ake padha deta hai

  • @kawshikkumarpaul8446
    @kawshikkumarpaul8446 4 роки тому

    Make a QNA video after reaching 1M

  • @rohitpatle8170
    @rohitpatle8170 Рік тому +1

    // Problem No -->> 4
    import java.security.InvalidKeyException;
    import java.util.InputMismatchException;
    import java.util.Scanner;
    import java.util.SimpleTimeZone;
    class invalidinput extends InputMismatchException {
    public String toString() {
    return "Invalid input not allowed";
    }
    public String getMessage() {
    return "Please valid Number input";
    }
    }
    class ZeroException extends ArithmeticException{
    public String toString(){
    return "you can't divide by 0";
    }
    public String getMessage(){
    return "you any number type but 0 can't be type";
    }
    }
    class MaxInputException extends InputMismatchException{
    public String toString(){
    return "Number can't exceed 100000";
    }
    public String getMessage(){
    return "ls enter a number 100000 || b>100000)
    throw new MaxInputException();
    System.out.println("Enter the operation sign: ");
    op=sc.next().charAt(0);
    switch(op)
    {
    case '+':
    sol=a+b;
    break;
    case '-':
    sol=a-b;
    break;
    case '/':
    if(b==0)
    throw new ZeroException();
    else
    sol=a/b;
    break;
    case '*':
    if( a>7000 || b>7000 )
    throw new MaxMultiplierReachedException();
    else
    sol=a*b;
    break;
    default:
    throw new ZeroException();
    }
    System.out.println("The ans is: "+sol);
    }
    }

  • @amanbhobhria4418
    @amanbhobhria4418 4 роки тому +1

    5:37 illegal Argument kaise aige
    Kya input dene se illegal Argument aige.
    Sir please btao ???

    • @977328176
      @977328176 3 роки тому +1

      bhai print karte waqt kuch illegal dalega usse kehte hai illrgal Arguments