c++ css assignments lab and homework totally 2 questions

c++ css assignments lab and homework totally 2 questions

Lab 1 : Lo Shu Magic Square Game

Refer to the Programming Challenge #8 in chapter 7 of the textbook (page 456 in the 9th edition) to understand how this game works.

Specific requirements for this lab:

1) Define a class LoShuSquare with the necessary data and functions to play the game. Use a 2-D int array with three rows and three columns as the game grid. The class should also have the following functions:

  • A constructor to initialize the grid with zeros.
  • A function to fill a specific square with a number 1-9, given row and column.
    • For example, fill (0, 0, 4) will change the upper leftmost square to 4.
  • A function to print the board on the screen
  • A function to check if the grid is a Lo Shu Square. You may want to break this into multiple functions to check rows, columns and diagonals separately.

2) Define a class Player to implement the interaction with the user, such as asking for values to fill out the grid. The constructor should receive an object of the LoShuSquare class as a parameter.

3) The main function that I will use to test your game is given. You just have to turn in Player.h and LoShuSquare.h (these header files should have all your code implemented as inline functions).

Some Rubric (2)

Some Rubric (2)

Criteria Ratings Pts

This criterion is linked to a Learning OutcomeDocumentationFollows published guidelines.

5.0 pts

Full Marks

0.0 pts

No Marks

5.0 pts

This criterion is linked to a Learning OutcomeLoShuSquare constructor and destructorConstructor should initialize the grid with zeros. Destructor is only necessary if using dynamic memory allocation.

5.0 pts

Full Marks

0.0 pts

No Marks

5.0 pts

This criterion is linked to a Learning OutcomeLoShuSquare fill functionAdds a value to a specific place on the grid.

5.0 pts

Full Marks

0.0 pts

No Marks

5.0 pts

This criterion is linked to a Learning OutcomeLoShuSquare print functionPrints the grid on the screen.

5.0 pts

Full Marks

0.0 pts

No Marks

5.0 pts

This criterion is linked to a Learning OutcomeLoShuSquare check function(s)Checks if the grid is a Lo Shu Square

15.0 pts

Full Marks

0.0 pts

No Marks

15.0 pts

This criterion is linked to a Learning OutcomePlayer classHandles the interface with the user asking what values to put where on the grid. Make sure to always update the screen with the new grid after inserting a value, so it is easy to keep track of where the values are.

15.0 pts

Full Marks

0.0 pts

No Marks

15.0 pts

Total Points: 50.0


Homework 2

In this homework assignment you will use the algorithms presented in this chapter to implement a list of names that should be kept in alphabetical order.

Section 18.2 defines the Linked List Operations based on a list of numbers. You will change this code to work with a list of names. You can keep single names only (without space).

struct ListNode

{

string name;

struct ListNode *next;

};

Rename class NumberList to something more appropriate like StringList or NamesList. You will also need to change the methods to work with strings instead of numbers. You will only need two of the list operations: insertNode and displayList. Change them to work with the new type. Keep the constructor and destructor. Note that the destructor needs to delete one node at a time as shown in Destroying the List section.

Your main program should instantiate an object of the NamesList and ask the user to enter a list of names, which you will insert in alphabetical order by calling the insertNode method. When the user is done entering the names, call the displayList method to display the names, which should be in alphabetical order.

Turn in one .cpp file with the class implementation and the main function.

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper