Java

Hi when I tried to insert my output the void displayed null or 0 can you tell me what's wrong with my rpogram? tnx

My main program

`package zarashop;

int choice;

public static void main(String[] args)
    Scanner absorb = new Scanner(System.in);

    // phase 1 login
    cloth cl = new cloth(); // declaring objects
    payment pay = new payment();
    personalinfo pi = new personalinfo();
    receipt re = new receipt();
    receipt2 re2=new receipt2();
    System.out.println("Welcome to Zara's cloth Shopping Center");
    System.out.println("\nThis an online Shopping application will help you to buy "+ "a new cloth");
    System.out.println("\nPlease enter your detail");
     System.out.println("\nPlease enter your name");
     String Name = absorb.nextLine(); // user input name
     System.out.println("\nAre you a member (yes) or (no)");
     String personalchoice = absorb.nextLine(); // user input status
     pi.setName(Name);// store value

     //phase 2 choosing cloth
     System.out.println("\nShopping" );
     System.out.println("enter price of your cloth  ");
     int clothA= absorb.nextInt(); 
     System.out.println("enter quantity  ");
     int quantity = absorb.nextInt(); 

     pay.setclothA(clothA); // store value
     pay.setquantity(quantity); 

  System.out.println("\nshipping detail" );
   System.out.println("Enter Address ");
     String Address = absorb.next(); // user input name
  System.out.println("Enter type of card: Debit/Credit ");
     String TypeCard = absorb.next(); // user input name
     System.out.println("Enter your telephone number ");
     int TeleNo= absorb.nextInt();
   System.out.println(" Card number ");
     String CardNo = absorb.next(); // user input name

   pi.setAddress(Address);
   pi.setTypeCard(TypeCard);
   pi.setTeleNo(TeleNo);
   pi.setCardNo(TeleNo);

     // phase 4 payment

     System.out.println("please press 1 to calculate your payment");
     int choice = absorb.nextInt();
     if(choice == 1){
         pay.total();    
     }

 // phase 5 receipt 
  System.out.println("your receipt");
 re2.receiptpi();
     re.receiptc();   
}}

Main class for cloth

package zarashop;

// main class
public class cloth {

    // superclass
    public int quantity; // for BMI  
     public int  clothA;
     public int total;
     //void
     void setclothA(int ca){
         clothA = ca;
     }
    void setquantity(int q){
        quantity=q;
    }
    void settotal(int t){
        total=t;
    }
    //get

    int getclothA(){
        return clothA;
    }
    int getquantity(){
        return quantity;
    }
    int gettotal(){
        return quantity;
    }
}

sub class for payment

public class payment extends cloth {
    //subclass

    String Status = "Initial";
    public void total(){

    int ca = super.getclothA(); //fetching values
    int q = super. getquantity();
    int t =super.gettotal();
     t= q*ca;

}

}

main class for personal info

public class personalinfo {

    // superclass
    public String Name; 
   public int Password; // \
    public String TypeCard; // 
    public int CardNo; //    
    public String Address; // 
    public int TeleNo; //  

    //void

    void setName(String n){
        Name = n;
    }
    void setPassword(int p){
        Password = p;
    }
    void setTypeCard(String tp){
        TypeCard = tp;
    }
    void setCardNo ( int cn){
        CardNo=cn;
    }
    void setAddress (String a){
        Address = a;
    }
    void setTeleNo ( int tl){
        TeleNo=tl;
    }
   //get

    String getName(){
        return Name;

    }
    String getAddress(){
        return Address;
    }
         int getPassword(){
             return Password;
         }
         String getTypeCard(){
             return TypeCard;
         }
         int getCardNo(){
             return CardNo;
         }
         int getTeleNo (){
             return TeleNo;
         }

}

subclass for cloth receipt

public class receipt extends payment{

    public void receiptc(){

    int ca = super.getclothA(); //fetching values
    int q = super. getquantity();
    int t = super. gettotal();

    System.out.println("cloth: " + ca);
    System.out.println("quantity: " + q);
    System.out.println("total" + t);
}
}

subclass for receipt personal info

public class receipt2 extends personalinfo {
    public void receiptpi(){
        String n = super.getName();
         String a = super.getAddress();
         String tp=super.getTypeCard();
        int cn = super.getCardNo();//fetching values
        int tl=super.getTeleNo();

        System.out.println("Name: " + n);
    System.out.println("Address: " + a);
    System.out.println("Card Type: " + tp);
    System.out.println("Card Number: " + cn);
    System.out.println("telephone Number: " + tl);

}
}

`

Exactly which output is wrong, and what exactly does it display?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.