Write a class encapsulating a PCbased game which inherits fr

Write a class encapsulating a PC-based game, 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 megabytes 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.

I need to use the games and information included in this picture.

PLEASE HELP!!!

Problems Javadoc Declaration Console

Solution

Game Class:

public class Game { private String description;

public Game(String newDescription)

{

setDescription(newDescription);

}

public String getDescription()

{

return description;

}

public void setDescription(String newDescription)

{

description = newDescription;

}

public String toString()

{

return(\"description: \" + description);

}

public class PcGame extends Game { public int ram; public int hdd; public double CPU;

public PcGame(int startRam, int startHdd, double startCPU)

{

super(\"PC Game\");

ram = startRam;

hdd = startHdd;

CPU = startCPU;

}

public int getRam()

{

return ram;

}

public void setRam(int newRam)

{

ram = newRam;

}

public int getHdd()

{

return hdd;

}

public void setHdd(int newHdd)

{

hdd = newHdd;

}

public double getCPU()

{

return CPU;

}

public void setCPU(double newCPU)

{

CPU = newCPU;

}

public String toString()

{

return(\"Megabytes RAM needed: \" + ram + \"\ Megabytes of Hard Drive space needed: \" + hdd + \"\ CPU Speed Needed: \" + CPU);

}

public class PcGameClient { public static void main(String[]args) {

PcGame g1 = new PcGame(512, 1024, 3.7);

System.out.println(\"PC-Game before changes: \ \" + g1.toString());

g1.setRam(2048);

g1.setHdd(22312);

g1.setCPU(2.8);

System.out.println(\"\ PC-Game after changes: \ \" + g1.toString());

}

}

Write a class encapsulating a PC-based game, which inherits from Game. A PC-based game has the following additional attributes: the minimum megabytes of RAM nee
Write a class encapsulating a PC-based game, which inherits from Game. A PC-based game has the following additional attributes: the minimum megabytes of RAM nee
Write a class encapsulating a PC-based game, which inherits from Game. A PC-based game has the following additional attributes: the minimum megabytes of RAM nee

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site