I am getting errors at the class names    package sullivan13; import java.text.NumberFormat; public abstract class Automobiles implements Comparable{ //Variables      private String model;     private String make;     private int year;     private double price;          //Constructor     public Automobiles(String make ,String model, int year, double price) {         this.make = make;         this.model = model;         this.year  = year;         this.price = price;     }     //Getters           public String getMake()     {         return make;     }          public String getModel()     {         return model;     }     public int getYear()     {         return year;     }     public double getPrice()     {         return  price;     }          //Overrider      public void display() {         System.out.println(this.model+" " +this.year+" ");     }      //Overrider      @Override      //CompareTO      public String toString() {         NumberFormat formatter = NumberFormat.getCurrencyInstance();                  return " Make: "+make+ " Model: "+model+ " Year: "+year+ "Price: "+formatter.format(price);             }     @Override      public int compareTo(Automobiles o) {         if(this.yearo.year)             return 1;         else             return 0;     } } package sullivan13; import java.util.ArrayList; import java.util.Collections; public class Test{     public static void main(String[] args)      //Create arraylist of Automobiles      {         ArrayList automobiles = new ArrayList<>();         automobiles.add(new Automobiles("Ford"," Escape ", 2022,20000));         automobiles.add(new Automobiles("Toyota","Camry", 2023,28000));         automobiles.add(new Automobiles("BMW", "Polo", 2018,113000));         automobiles.add(new Automobiles("Buick","Shar", 2023,26000));         automobiles.add(new Automobiles("Ford","Mustang", 2019,20000));         for (int i =0; i

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

I am getting errors at the class names 

 

package sullivan13;
import java.text.NumberFormat;

public abstract class Automobiles implements Comparable<Automobiles>{

//Variables 
    private String model;
    private String make;
    private int year;
    private double price;
    
    //Constructor
    public Automobiles(String make ,String model, int year, double price) {
        this.make = make;
        this.model = model;
        this.year  = year;
        this.price = price;
    }

    //Getters 
    
    public String getMake()
    {
        return make;
    }
    
    public String getModel()
    {
        return model;
    }
    public int getYear()
    {
        return year;
    }
    public double getPrice()
    {
        return  price;
    }
    
    //Overrider 
    public void display() {
        System.out.println(this.model+" " +this.year+" ");
    }
    
//Overrider 
    @Override
    
//CompareTO 
    public String toString() {
        NumberFormat formatter = NumberFormat.getCurrencyInstance();
        
        return " Make: "+make+ " Model: "+model+ " Year: "+year+ "Price: "+formatter.format(price);        
    }
    @Override 
    public int compareTo(Automobiles o) {
        if(this.year<o.year)
            return-1;
        else if(this.year>o.year)
            return 1;
        else
            return 0;
    }
}

package sullivan13;
import java.util.ArrayList;
import java.util.Collections;


public class Test{
    public static void main(String[] args) 
    //Create arraylist of Automobiles 
    {
        ArrayList<Automobiles> automobiles = new ArrayList<>();
        automobiles.add(new Automobiles("Ford"," Escape ", 2022,20000));
        automobiles.add(new Automobiles("Toyota","Camry", 2023,28000));
        automobiles.add(new Automobiles("BMW", "Polo", 2018,113000));
        automobiles.add(new Automobiles("Buick","Shar", 2023,26000));
        automobiles.add(new Automobiles("Ford","Mustang", 2019,20000));
        for (int i =0; i<automobiles.size();i++) {
            automobiles.get(i).display();
        }
        //Sort the arrayList 
        Collections.sort(automobiles);
        //Display using the loop
        System.out.println("After sort the data...");
        for (Automobiles a:automobiles)
        {
            System.out.println(a);
        }
    }
    
}

 

אואואואואווא
*Automobiles.java
1 package sullivan13;
2 import java.util.ArrayList;
3 import java.util.Collections;
dddd
5
6 public class Test{
70
8
9
12
COCA WNHOS CO
13
14
X15
16
NNNNNNNNNNH
17
18
19
20
21
22
23
24
25
26
27
28
29 }
30
31
public static void main(String[] args)
//Create arraylist of Automobiles
{
*Test.java X
}
}
11
ArrayList<Automobiles> automobiles = new ArrayList<> ();
automobiles.add(new Automobiles ("Ford", Escape", 2022, 20000));
automobiles.add(new Automobiles ("Toyota", "Camry", 2023,28000));
automobiles.add(new Automobiles ("BMW", "Polo", 2018, 113000));
automobiles.add(new Automobiles ("Buick", "Shar", 2023, 26000));
automobiles.add(new Automobiles ("Ford", "Mustang", 2019, 20000));
for (int i=0; i<automobiles.size(); i++) {
automobiles.get(i).display();
}
//Sort the arrayList
Collections. sort (automobiles);
//Display using the loop
System.out.println("After sort the data...");
for (Automobiles a:automobiles)
{
S
System.out.println (a);
G
↑
Transcribed Image Text:אואואואואווא *Automobiles.java 1 package sullivan13; 2 import java.util.ArrayList; 3 import java.util.Collections; dddd 5 6 public class Test{ 70 8 9 12 COCA WNHOS CO 13 14 X15 16 NNNNNNNNNNH 17 18 19 20 21 22 23 24 25 26 27 28 29 } 30 31 public static void main(String[] args) //Create arraylist of Automobiles { *Test.java X } } 11 ArrayList<Automobiles> automobiles = new ArrayList<> (); automobiles.add(new Automobiles ("Ford", Escape", 2022, 20000)); automobiles.add(new Automobiles ("Toyota", "Camry", 2023,28000)); automobiles.add(new Automobiles ("BMW", "Polo", 2018, 113000)); automobiles.add(new Automobiles ("Buick", "Shar", 2023, 26000)); automobiles.add(new Automobiles ("Ford", "Mustang", 2019, 20000)); for (int i=0; i<automobiles.size(); i++) { automobiles.get(i).display(); } //Sort the arrayList Collections. sort (automobiles); //Display using the loop System.out.println("After sort the data..."); for (Automobiles a:automobiles) { S System.out.println (a); G ↑
Ic Homep eclipse-workspace - sullivan13/src/sullivan 13/Automobiles.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
HO
□
Q: *
0-2-2-
your Ba
plus 3
SK AN EXP
ject mat
omonte
*Automobiles.java X *Test.java
1 package sullivan13;
2 import java.text.Number Format;
extbook
9
10
11
4 public abstract class Automobiles implements Comparable<Automobiles> {
5
6 //Variables
7
8
12
Ⓒ130
14
15
16
17
18
19
20
21
220
23
24
25
26
270
28
29
30
310
32
33
arn about 34
complexit 350
time, ques
36
37
38
39
40
stion to a 410
42
se fast
private String model;
private String make;
private int year;
private double price;
//Constructor
}
public Automobiles (String make,String model, int year, double price) {
this.make = make;
this.model = model;
this.year = year;
this.price = price;
//Getters
public String getMake ()
{
}
public String getModel ()
{
}
return make;
}
public int getYear()
{
}
return model;
public double getPrice ()
{
}
return year;
return price;
43
44
45 //Overrider
460
▾
//Overrider
public void display() {
System.out.println(this.model+" " +this.year+" ");
AND T • • •
T
@Override
47
48 //CompareTO
49
50
51
public String toString() {
NumberFormat formatter = Number Format.getCurrency Instance();
Transcribed Image Text:Ic Homep eclipse-workspace - sullivan13/src/sullivan 13/Automobiles.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help HO □ Q: * 0-2-2- your Ba plus 3 SK AN EXP ject mat omonte *Automobiles.java X *Test.java 1 package sullivan13; 2 import java.text.Number Format; extbook 9 10 11 4 public abstract class Automobiles implements Comparable<Automobiles> { 5 6 //Variables 7 8 12 Ⓒ130 14 15 16 17 18 19 20 21 220 23 24 25 26 270 28 29 30 310 32 33 arn about 34 complexit 350 time, ques 36 37 38 39 40 stion to a 410 42 se fast private String model; private String make; private int year; private double price; //Constructor } public Automobiles (String make,String model, int year, double price) { this.make = make; this.model = model; this.year = year; this.price = price; //Getters public String getMake () { } public String getModel () { } return make; } public int getYear() { } return model; public double getPrice () { } return year; return price; 43 44 45 //Overrider 460 ▾ //Overrider public void display() { System.out.println(this.model+" " +this.year+" "); AND T • • • T @Override 47 48 //CompareTO 49 50 51 public String toString() { NumberFormat formatter = Number Format.getCurrency Instance();
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY