// Arup Guha
// 10/16/2026
// McClaren class for COP 3330 Exam 2 (Has Question 5 Solution)

import java.util.*;

public class McClaren extends Car {

	private double fastMPG;
	
	// Constructor.
	public McClaren(double myTankSize, double myMPG, double raceMPG) {
		
		// We must call super first just set up the regular car.
		super(myTankSize, myMPG);
		
		// Now we do this part in this constructor.
		fastMPG = raceMPG;
	}
	
	// This is basically the drive method but with fastMPG instead of mpfg...
	public double race(double miles) {
		double ret = Math.min(miles, galGasLeft*fastMPG);
		galGasLeft -= (ret/fastMPG);
		odometer += ret;
		return ret;
	}
	
	public String toString() {
		return "["+tankSize+", "+galGasLeft+", "+mpg+", "+fastMPG+", "+odometer+", "+expenses+"]";
	}
	
	/*** I just put several tests in here to test basic functionality. ***/
	public static void main(String[] args) {
		
		// Set up 3 Cars.
		Car[] cars = new Car[3];
		cars[0] = new Car(10, 30);
		cars[1] = new Car(15, 17);
		cars[2] = new McClaren(20, 15, 8);
		for (Car c: cars) System.out.println(c);
		System.out.println();
		
		// Drive them.
		cars[0].drive(100);
		cars[1].drive(150);
		cars[2].drive(200);
		for (Car c: cars) System.out.println(c);
		System.out.println();
		
		// Race a little bit!
		((McClaren)cars[2]).race(20);
		for (Car c: cars) System.out.println(c);
		System.out.println();
		
		// Time to park.
		for (Car c: cars) c.park(5, 3);
		for (Car c: cars) System.out.println(c);
		System.out.println();
		
		// And get gas...
		for (Car c: cars) c.fillGas(8, 4.25);
		for (Car c: cars) System.out.println(c);
		System.out.println();
	}	
}