Create a class named CollegeCourse that includes data fields that hold the department (for example, ENG), the course number (for example, 101), the credits (for example, 3), and the fee for the course (for example, $360). All of the fields are required as arguments to the constructor, except for the fee, which is calculated at $120 per credit hour. Include a display() method that displays the course data. Create a subclass named LabCourse that adds $50 to the course fee. Override the parent class display() method to indicate that the course is a lab course and to display all the data. Write an application named UseCourse that prompts the user for course information. If the user enters a class in any of the following departments, create a LabCourse: BIO, CHM, CIS, or PHY. If the user enters any other department, create a CollegeCourse that does not include the lab fee. Then display the course data. Save the files as CollegeCourse.java, LabCourse.java, and UseCourse.java.
สร้างคลาสชื่อ collegecourse ที่มีเขตข้อมูลที่ถือกรม ( ตัวอย่างเช่น , Eng ) , ตัวเลข ( ตัวอย่างเช่น , 101 ) หน่วยกิต ( ตัวอย่าง 3 ) และค่าธรรมเนียมสำหรับหลักสูตร ( ตัวอย่างเช่น $ 360 ) ทั้งหมดของเขตข้อมูลจะต้องเป็นอาร์กิวเมนต์กับผู้รับเหมาก่อสร้าง ยกเว้นค่าธรรมเนียมซึ่งคำนวณสินเชื่อที่ $ 120 ต่อ ชั่วโมงรวม display() วิธีที่แสดงข้อมูลหลักสูตร สร้างคลาสชื่อ labcourse ที่เพิ่ม $ 50 ค่าแน่นอน ยกเลิก display() เรียนผู้ปกครองวิธีการระบุว่าเป็นวิชา Lab หลักสูตรและเพื่อแสดงข้อมูลทั้งหมด เขียนโปรแกรมชื่อ usecourse ที่จะแจ้งให้ผู้ใช้ข้อมูลหลักสูตร ถ้าผู้ใช้ที่เข้ามาเรียนในใด ๆของหน่วยงานดังต่อไปนี้สร้าง labcourse : ชีวภาพ , CHM , CIS , หรือ PHY . ถ้าผู้ใช้ป้อนหน่วยงานอื่นใดสร้าง collegecourse ที่ไม่รวมค่า Lab แล้วแสดงข้อมูลหลักสูตร บันทึกไฟล์เป็น collegecourse.java labcourse.java , และ usecourse.java .
การแปล กรุณารอสักครู่..
