Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please read my question if you post copy and pasted code you will get a negative

ID: 3837508 • Letter: P

Question

Please read my question if you post copy and pasted code you will get a negative review.

This is java

In this graphical program, you are going to simulate arcade car racing game. You need a single player that is movable with the arrow keys, and you need another vehicle that will race the player. You should be able to race by hitting the right arrow key toward the end of the screen. If you get to the end of the screen, the car should start over on the left side of the screen. The AI car should start over but should move faster this time. Each time you make it to the end of the screen before the AI, you gain a point. If the AI makes it before you, the game is over. You should be able to play the game for 30 seconds. (i.e. you should survive for at least 30 seconds). Don’t worry about collision detection with the AI car.

At the end of the simulation, you should gather the person’s name, their favorite number, and their email address. You should check to make sure it is correctly formatted.

Specifics:

Gather the person’s name.

Gather the person’s favorite number – should be a number.

Collect the individual’s email – should have an @ and the ". " operator.

Should pre-emptively check all those values as well as have exception handlers where

appropriate.

Should have a countdown clock that starts at 30 and counts down to 0.

The AI car should race the player until the clock hits zero.

The player object should be able to move using the arrow keys.

Ignore collision detection.

For any exception handlers, you should write any exceptions to a log file.

Explanation / Answer

open class CarPanel develops JPanel {
private roast forwardKey = 'w';
private boolean reachedTarget = false;
private Color shading = Color.blue;
private int x= 10;
private int y= 10;
private int panelWidth;
private int panelHeight;
/default Constructor
open CarPanel(){
}
/over-burden Constructor
open CarPanel(char scratch, Color color){
this.forwardKey=key;
this.color = shading;
}
ensured void paintComponent(Graphics g){
super.paintComponent(g);
panelWidth= getWidth();
panelHeight= getHeight();
/draw a Car
g.setColor(color);
/polygon focuses
int t_x[]= {x+10,x+20,x+30,x+40};
int t_y[]= {y+10,y,y,y+10};
g.fillPolygon(t_x,t_y,t_x.length);
g.fillRect(x, y+10, 50, 10);
g.fillArc(x+10, y+20, 10, 10, 0, 360);
g.fillArc(x+30, y+20, 10, 10, 0, 360);
}
@Override
open Dimension getPreferredSize() {
return new Dimension(750,100);
}
open void moveCar(){
if(this.x < panelWidth){
this.x+=10;
repaint();
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote