Create a computer class and assume computers have the following fields:
- String manufacture,
- double price,
- int year
In addition, the computer has the following methods:
void start() {
System.out.println( manufacture + " computer starts." );
}
void process(String fileName)
{
System.out.println( manufacture + " computer is processing " + fileName );
}
void shutdown ()
{
System.out.println( manufacture + " computer is shut down);
}
In addition, create a constructor which is used to initialize all these three fields when we create objects. The example can be found in the slides.
Create a ComputerTest class, in its main() method, create two computers, assume one computer is made by Sony, the year is 2012, and the price is 700 dollars; The other is made by Apple, the year is 2001, and the price is 1800 dollars;
Then call the start(), process(String fileName), and shutdown() functions of these two computers. Assume the name of the file processed by Sony computer is "Mid-Exam", and the name of the file processed by Apple computer is "Final-Exam".