In this activity, you will write your own a Java program that makes use of inheritance to develop derived classes from a base class.

PROG6112_LU2_Class_A_B_C
Instructions:
Using any application of your choice, write a Java program for a business that collects and sells antiques. In your program:
Create a class named ItemSold with three fields for an invoice number, a description and a price Get and set methods for each field;
Create a subclass named LampSold that descends from ItemSold and includes Boolean fields that indicate the condition and age of an antique item. Include the necessary get and set methods;
Write an application that creates 2 objects of each class and demonstrate that all the methods work correctly.
Save your program, compile and run it until it is working correctly.
Save a screenshot of the output using your student number in the file name.
Return to this screen and click the link above the red arrow to open the Blog tool.
Create a new entry and:
Type Inheritance in the Title field;
Attach your screenshot;
Briefly describe what aspect(s) of this activity you found difficult.

in java code

Here is the Java code for the program:

```java
class ItemSold {
private int invoiceNumber;
private String description;
private double price;

public int getInvoiceNumber() {
return invoiceNumber;
}

public void setInvoiceNumber(int invoiceNumber) {
this.invoiceNumber = invoiceNumber;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public double getPrice() {
return price;
}

public void setPrice(double price) {
this.price = price;
}
}

class LampSold extends ItemSold {
private boolean condition;
private int age;

public boolean isCondition() {
return condition;
}

public void setCondition(boolean condition) {
this.condition = condition;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}
}

public class Main {
public static void main(String[] args) {
ItemSold item1 = new ItemSold();
item1.setInvoiceNumber(101);
item1.setDescription("Antique painting");
item1.setPrice(1000.0);

ItemSold item2 = new ItemSold();
item2.setInvoiceNumber(102);
item2.setDescription("Antique sculpture");
item2.setPrice(1500.0);

LampSold lamp1 = new LampSold();
lamp1.setInvoiceNumber(201);
lamp1.setDescription("Antique brass lamp");
lamp1.setPrice(500.0);
lamp1.setCondition(true);
lamp1.setAge(50);

LampSold lamp2 = new LampSold();
lamp2.setInvoiceNumber(202);
lamp2.setDescription("Antique wooden lamp");
lamp2.setPrice(800.0);
lamp2.setCondition(false);
lamp2.setAge(70);

System.out.println("Item 1:");
System.out.println("Invoice Number: " + item1.getInvoiceNumber());
System.out.println("Description: " + item1.getDescription());
System.out.println("Price: $" + item1.getPrice());
System.out.println();

System.out.println("Item 2:");
System.out.println("Invoice Number: " + item2.getInvoiceNumber());
System.out.println("Description: " + item2.getDescription());
System.out.println("Price: $" + item2.getPrice());
System.out.println();

System.out.println("Lamp 1:");
System.out.println("Invoice Number: " + lamp1.getInvoiceNumber());
System.out.println("Description: " + lamp1.getDescription());
System.out.println("Price: $" + lamp1.getPrice());
System.out.println("Condition: " + lamp1.isCondition());
System.out.println("Age: " + lamp1.getAge());
System.out.println();

System.out.println("Lamp 2:");
System.out.println("Invoice Number: " + lamp2.getInvoiceNumber());
System.out.println("Description: " + lamp2.getDescription());
System.out.println("Price: $" + lamp2.getPrice());
System.out.println("Condition: " + lamp2.isCondition());
System.out.println("Age: " + lamp2.getAge());
}
}
```

In this program, we have a base class called `ItemSold` with fields for invoice number, description, and price. The class also has getter and setter methods for each field.

We then create a subclass called `LampSold` that extends `ItemSold` and adds two additional fields for condition and age. The subclass also includes the necessary getter and setter methods for these fields.

In the main method, we create two objects of each class and demonstrate that all the methods work correctly by setting values for the fields and printing them out.

If you run this code, it will display the details of the items and lamps created.

Please note that you need to use any Java IDE or editor to compile and run the code.