Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Hello {
- public static void main(String[] args) {
- airCraft A1 = new airCraft("A1", "piper", 30, 450);
- A1.Display();
- System.out.println("A1's Endurence rateis : " +A1.CalculateEndurence(150.00, 10.00));
- }
- }
- class airCraft{
- String name;
- String model;
- int passengers;
- int speed;
- double fuelCapacity;
- double fuelRate;
- airCraft(String n, String m, int p, int s) {
- n = name;
- m = model;
- p = passengers;
- s = speed;
- }
- void Display()
- {
- System.out.println("A1's name is: " +name);
- System.out.println("A1's model is: " +model);
- System.out.println("A1's number of passenger is: " +passengers);
- System.out.println("A1's speed is: " +speed);
- }
- public double CalculateEndurence(double fuelCapacity,double fuelRate)
- {
- double endurence = fuelCapacity/fuelRate;
- return endurence;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement