title: Need some help in Java Inheritance! (In LuxuryCarRental int days is always coming as 0)
body: <p>Create a class named CarRental that contains fields that hold a renter’s name, zip code, size of the car rented, daily rental fee, length of rental in days, and total rental fee. The class contains a constructor that requires all the rental data accept the daily rate and total fee, which are calculated, based on the size of the car: economy at $29.99 per day, midsize at $38.99 per day, or full size at $43.50 per day. The class also includes a display() method that displays all the rental data.</p>
  
  <p>Create a subclass named LuxuryCarRental. This class sets the rental fee at $79.99 per day and prompts the user to respond to the option of including a chauffeur at $200 more per day. Override the parent class display() method to include chauffeur fee information. Write an application named UseCarRental that prompts the user for the data needed for a rental and creates an object of the correct type. Display the total rental fee.</p>
  
  <p>Save the files as CarRental. java, LuxuryCarRental. java, and UseCarRental. java</p>
  
  <pre><code>public class CarRental
  {
  String name;
  int zip;
  String size;
  double dailyFee;
  int days;
  double total;
  
  public CarRental(String size)
  {
  
  if(size.charAt(0)=='e')
    dailyFee = 29.99;
  else if(size.charAt(0)=='m')
    dailyFee = 38.99;
  else
    dailyFee =43.50;
  }
  public String getname()
  {
    return name;
  }
  public int getzip()
  {
    return zip;
  }
  public String getsize()
  {
  return size;
  }
  public int getdays()
  {
    return days;
  }
  public void computetotal(int days)
  {
  total = dailyFee*days;
  }
  public void print()
  {
  System.out.println("The cost of your rental car is $" + total);
  }
  } 
  
  
  
  
  
  
  public class LuxuryCarRental extends CarRental
  {
  public LuxuryCarRental(String size, int days)
  {
  super(size);
  }
  public void computetotal1()
  {
  super.computetotal(days);
  dailyFee = 79.99;
   total = dailyFee;
  System.out.println(days);    //trying to see if days still 0
  }
  }
  
  
  
  
  
  
  import javax.swing.*;
  import java.util.Scanner;
  public class UseCarRental
  {
  public static void main(String args[]) throws Exception
  {
  int days;
  String name;
  int zip;
  String size;
  Scanner inputDevice = new Scanner(System.in);
  System.out.println("Enter days: ");
  days= inputDevice.nextInt();
  System.out.println("Enter name: ");
  name = inputDevice.next();
  System.out.println("Enter zip: ");
  zip = inputDevice.nextInt();
  System.out.println("Enter size: ");
  size = inputDevice.next();
  CarRental econ = new CarRental(size);
  econ.computetotal(days);
  econ.print();
  CarPhone full = new CarPhone(size, days);
  full.computetotal1();
  full.print();
  } 
  }
  </code></pre>