Note that there are some explanatory texts on larger screens.

plurals
  1. POError; cannot find symbol; Symbol: variable super
    text
    copied!<p>I am working on 3 programs that contain the classes CarRental.java, LuxuryCarRental.java, and UseCarRental.java, On my LuxuryCarRental.java, I keep getting the error, Error; cannot find symbol; Symbol: variable super for the class, here is my program, I'm relatively new to Java, so please be detailed! Thanks in advance!</p> <pre><code>import java.text.DecimalFormat; public class LuxuryCarRental extends CarRental{ private boolean chauffeur; private double dailyChauffeurFee; public LuxuryCarRental(String renterName, int renterZip, String sizeOfCar,int rentalDays, boolean chauffeur) { super(renterName, renterZip, sizeOfCar, rentalDays); this.chauffeur = chauffeur; } public void display(){ super.dailyRentalFee = 79.99; this.dailyChauffeurFee = 0; if(chauffeur){ this.dailyChauffeurFee = 200; } super.totalRentalFee = super.dailyRentalFee * super.getRentalDays() + this.dailyChauffeurFee * super.getRentalDays(); DecimalFormat df = new DecimalFormat("0.00"); System.out.println("Car Rental - Renter Name : " + super.getRenterName() + ", Renter Zip: " + super.getRenterZip() + ", Rental Days : " + super.getRentalDays() + ", Daily Rental Fee: " + dailyRentalFee + ", Daily Chauffer Fee: " + dailyChauffeurFee + ", Total Rental Fee: " + df.format(totalRentalFee)); } } </code></pre> <p>And here are all the classes from all three of my programs that correspond to each other.</p> <pre><code> public class CarRental { private String renterName; private int renterZip; private String sizeOfCar; private int rentalDays; protected double dailyRentalFee; protected double totalRentalFee; public class UseCarRental public class LuxuryCarRental extends CarRental { private boolean chauffeur; private double dailyChauffeurFee; public CarRental(String renterName, int renterZip, String sizeOfCar, int rentalDays) { renterName = renterName; renterZip = renterZip; sizeOfCar = sizeOfCar; rentalDays = rentalDays; </code></pre> <p>And my altered code:</p> <pre><code>public class CarRental { public static void main(String[] args) { private String renterName; private int renterZip; private String sizeOfCar; private int rentalDays; protected double dailyRentalFee; protected double totalRentalFee; } public CarRental(String renterName, int renterZip, String sizeOfCar, int rentalDays) { renterName = renterName; renterZip = renterZip; sizeOfCar = sizeOfCar; rentalDays = rentalDays; } public void setDailyRentalFee(double dailyRentalFee) { this.dailyRentalFee = dailyRentalFee; } public double getDailyRentalFee() { return dailyRentalFee; } public void display(){ if(sizeOfCar.equalsIgnoreCase("economy")) { dailyRentalFee = 29.99; } else if(sizeOfCar.equalsIgnoreCase("midsize")) { dailyRentalFee = 38.99; } else { dailyRentalFee = 43.50; } //calculates total rental fee this.totalRentalFee = this.dailyRentalFee * rentalDays; DecimalFormat df = new DecimalFormat("0.00"); //displays output System.out.println("Car Rental - Renter Name : " + renterName + ", Renter Zip: " + renterZip + ", Size of car: " + sizeOfCar + ", Rental Days : " + rentalDays + ", Daily Rental Fee: " + dailyRentalFee + ", Total Rental Fee: " + df.format(totalRentalFee)); } public String getRenterName() { return renterName; } public int getRenterZip() { return renterZip; } public int getRentalDays() { return rentalDays; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload