Write a class encapsulating a PC-based game in the package com.labs.lab6.games , which inherits from Game . A PC-based game has the following additional attributes: the minimum megabytes of RAM needed to play the game, the number of MB needed on the hard drive to install the game, and the minimum GHz performance of the CPU. Code the constructor and the toString method of the new class. You also need to include a client class to test your code.

Respuesta :

Answer:

Java.

Explanation:

class PC-game extends Game {

   int minRAM;

   int minDiskSpace;

   float minProcessorSpeed;

   //////////////////////////////////////////////////////////////////////////////////////////////////

   public PC-game(int minRam, minDiskSpace, minProcessorSpeed) {

       this.minRam = minRam;

       this.minDiskSpace = minDiskSpace;

       this.minProcessorSpeed = minProcessorSpeed;

   }

   public String toString() {  

       return "Ram megabytes: " + minRam + ", Disk Space MB: " + minDiskSpace + ", Processor GHz: " + minProcessorSpeed;

   }

   //////////////////////////////////////////////////////////////////////////////////////////////////

   public static void main(String[] args) {

       PC-game pcGame1 = new PC-game(512, 2000, 2.3);

       System.out.println(pcGame1);

   }

}