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 exceptthedailyrateandtotalfee,whicharecalculatedbasedonthesizeofthecar: economyat$29.99perday,midsizeat$38.99perday,orfullsizeat$43.50perday. The class also includes a display() method that displays all the rental data. 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. Save the files as CarRental.java, LuxuryCarRental.java, andUseCarRental.java.
สร้างชื่อระดับ CarRental ที่ประกอบด้วยเขตข้อมูลที่เก็บชื่อผู้เช่ารหัสไปรษณีย์ขนาดของรถเช่าค่าเช่ารายวัน, ความยาวของค่าเช่าในวันและค่าเช่ารวม ชั้นมีคอนสตรัคที่ต้องใช้ข้อมูลทั้งหมดที่เช่า exceptthedailyrateandtotalfee, whicharecalculatedbasedonthesizeofthecar: economyat $ 29.99perday, midsizeat $ 38.99perday, orfullsizeat $ 43.50perday ชั้นนี้ยังรวมถึงการแสดงผล () วิธีการที่จะแสดงข้อมูลทั้งหมดที่ให้เช่า สร้างรองชื่อ LuxuryCarRental ชั้นนี้กำหนดค่าเช่าที่ $ 79.99 ต่อวันและแจ้งให้ผู้ใช้เพื่อตอบสนองต่อตัวเลือกในการรวมทั้งคนขับรถที่ $ 200 ต่อวัน แทนที่จอแสดงผลระดับผู้ปกครอง () วิธีการรวมข้อมูลค่าคนขับรถ เขียนแอพลิเคชันชื่อ UseCarRental ที่แจ้งให้ผู้ใช้ข้อมูลที่จำเป็นสำหรับการเช่าและการสร้างวัตถุของชนิดที่ถูกต้อง แสดงค่าเช่ารวม บันทึกไฟล์เป็น CarRental.java, LuxuryCarRental.java, andUseCarRental.java
การแปล กรุณารอสักครู่..
