Question: Write Java program Develop a Java program that includes the following: (a) An interface Colourful that includes a method: colouring (String c), which has one

Write Java program Write Java program Develop a Java program that includes the following: (a)

Develop a Java program that includes the following: (a) An interface Colourful that includes a method: colouring (String c), which has one argument and returns nothing. When this method is implemented in any class, it assigns argument to color attribute. [2 marks] (b) A public class Device that: [10 marks] has one private attribute: double cost; and one public attribute boolean started. has a two-argument constructor that sets its attributes to given values. has a one-argument constructor that sets the value started attribute to given value, and sets cost to 200. It should invoke the two-argument constructor. has a start() method, which has no argument and returns nothing. The method sets value of started attribute to true, and displays a message: "Start up device". has a shut Down () method, which has no argument and returns nothing. The method sets value of started attribute to false, and displays a message: "Shut Down device". Overrides the object's toString() method in order to return a string representation of the cost attribute as the below format: The cost is: (c) A public class Computer that: [13 marks] inherits the Device class and implements the colourful interface. has two private attributes: String brand, and String color. has a four-argument constructor that sets the value of its attributes to given values. It should invoke its super class constructor. has a method openBrowser(), which has no argument and return nothing. The method displays a message: "Can't open browser" if started is false, and displays a message: "Browser opened with success otherwise. Override the Object's toString() method in order to return a string representation of the Computer attributes as the below format, it should invoke its super-class toString() method: Computer type is: - and its color is: The cost is: Hint: Implement any necessary methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!