Question

C++ Program


Program 1: WAKA, WAKA. Pac-Man was a big hit back in the 80s. One of the things he could do was “teleport” from one side of the screen to the other, and that’s what we’re going to implement here. For this program, you’re going to write a class that only has two attributes: an X and Y location. Imagine the player is on a 10x10 grid. If the player exceeds the bounds of the screen, their location teleports to the other side of the screen (e.g. far-right players go to the far-left). The class should include methods for going up, down, left and right. Finally, you should make a “driver” that brings an instance of this class to life in the middle of the “screen” and enables the player to move up, down, left and right. Design (pseudocode) and implement (source code) this program.

Sample run

Current location – X: 5 Y:5

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

U

Current location – X : 5 Y :4

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

U

Current location – X : 5 Y :3

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

U

Current location – X : 5 Y :2

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

U

Current location – X : 5 Y :1

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

U

Current location – X : 5 Y :0

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

U

Current location – X : 5 Y :9

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

R

Current location – X : 6 Y :9

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

R

Current location – X : 7 Y :9

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

R

Current location – X : 8 Y :9

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

R

Current location – X : 9 Y :9

(U)p, (D)own, (L)eft, (R)ight or (Q)uit:

0 0
Request Professional Answer

Request Answer!

We need at least 7 more requests to produce the answer.

3 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
C++ Program
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Please, I need help with program c++. This is a chutes and ladders program. The code...

    Please, I need help with program c++. This is a chutes and ladders program. The code must be a novel code to the specifications of the problem statement. Thank you very much. Assignment Overview This program will implement a variation of the game “chutes and ladders” or “snakes and ladders:” https://en.wikipedia.org/wiki/Snakes_and_Ladders#Gameplay. Just like in the original game, landing on certain squares will jump the player ahead or behind. In this case, you are trying to reach to bottom of the...

  • This program needs to be in JAVA language. Also, I need to create my own LinkedList...

    This program needs to be in JAVA language. Also, I need to create my own LinkedList class, I can not use the Java LinkedList Library. Please read all aspects of the program, it needs to display 200 random numbers that are 5 digits long sorted from smallest to largest. I can not use Collection(s) or packages libraries. Should only need: import java.util.Random; import java.util.Scanner; Please provide output screenshots after the code. Thank you! You are going to create a Linked...

  • Part 3: Arrows Write a python program that prompts the user for a number of columns,...

    Part 3: Arrows Write a python program that prompts the user for a number of columns, and them prints the pattern as seen below. You cannot assume that the user will supply positive numbers - if they misbehave you should re-prompt them until they do give you a positive number. Note that your program only has to run one time, but multiple runnings of the program are shown below: How many columns? 3 * * * * * How many...

  • This java assignment will give you practice with classes, methods, and arrays. Part 1: Player Class...

    This java assignment will give you practice with classes, methods, and arrays. Part 1: Player Class Write a class named Player that stores a player’s name and the player’s high score. A player is described by:  player’s name  player’s high score In your class, include:  instance data variables  two constructors  getters and setters  include appropriate value checks when applicable  a toString method Part 2: PlayersList Class Write a class that manages a list...

  • Spell it out! Use the following Java concepts to compile the program below:   String myName =...

    Spell it out! Use the following Java concepts to compile the program below:   String myName = "Chuck";     int length = myName.length();     char firstChar = myName.charAt(0);     char secondChar = myName.charAt(1);     if (myName.equals("Tom")) {       System.out.println ("Sorry, Tom!");   } Write a program that uses a METHOD to translate these individual characters:   input output input output input output input output input output a 4 g 9 m /\\/\\ s $ y ‘/ b B h |-| n |\\| t...

  • Write a program that prompts the user to enter a 10 alphabets (A-Z) and converts it...

    Write a program that prompts the user to enter a 10 alphabets (A-Z) and converts it to numbers using the following mapping: A, B, C = 8 D, E, F = 6 G, H, I = 4 J, K, L = 5 M, N, 0 = 7 P, Q, R, S = 2 T, U, V, W = 3 X, Y, Z = 1 Please be sure to use Object Oriented Programming concepts when designing and writing code for this...

  • 3. (30 pts) Consider the following game. Players can choose either left () or 'right' (r) The tab...

    3. (30 pts) Consider the following game. Players can choose either left () or 'right' (r) The table provided below gives the payoffs to player A and B given any set of choices, where player A's payoff is the firat number and player B's payoff is the second number Player B Player A 4,4 1,6 r 6,1 -3.-3 (a) Solve for the pure strategy Nash equilibria. (4 pta) (b) Suppose player A chooses l with probability p and player B...

  • This is a c++ question note: not using  namespace std; at the beginning of the program Writing...

    This is a c++ question note: not using  namespace std; at the beginning of the program Writing Data to a File This program will write a series of letters, starting with 'A', to an external file (letters.txt). The user will decide how many letters in total get saved to the file. ** IMPORTANT: The test cases will evaluate your code against .txt files that I uploaded. You do NOT have to upload your own txt files. Input: Including 'A', how many...

  • Write a C++ program that generates an array filled up with random positive integer number ranging...

    Write a C++ program that generates an array filled up with random positive integer number ranging from 15 to 20, and display it on the screen. After the creation and displaying of the array , the program displays the following: [P]osition [R]everse, [A]verage, [S]earch, [Q]uit Please select an option: Then, if the user selects: -P (lowercase or uppercase): the program displays the array elements position and value pairs for all member elements of the array. -R (lowercase or uppercase): the...

  • CODE IN C++ 13.5 Alphabet Histogram Write a program that reads input character by character from...

    CODE IN C++ 13.5 Alphabet Histogram Write a program that reads input character by character from the given data file "data.txt" The program should be case insensitive and count the number of occurances of each character in the alphabet. It should print a histogram of the results as follows: A : B : C : * D : * E : * F : G : H : I : J : * K : L : M : N...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT