Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- public class LuxuryCarRental extends CarRental
- {
- private double dailyFee = 79.99;
- public String entry;
- public LuxuryCarRental(String name, int zipCode, String size, int days)
- {
- super(name, zipCode, size, days);
- }
- public void calculateTotal()
- {
- super.calculateTotal(days);
- }
- public double chauffer()
- {
- double cfee;
- entry = JOptionPane.showInputDialog(null, "Would you like a chauffer for an additional $200 fee? Y/N");
- if (entry.toLowerCase() == "Y")
- {
- cfee = dailyFee + 200.00;
- return cfee;
- }
- else
- {
- return dailyFee;
- }
- }
- public void display()
- {
- super.display();
- if(entry.toLowerCase() == "Y")
- {
- JOptionPane.showMessageDialog(null, "You selected to have a chauffer");
- }
- else
- {
- JOptionPane.showMessageDialog(null, "You selected not to have a chauffer");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement