联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

您当前位置:首页 >> CS程序CS程序

日期:2023-10-05 07:48

INSTITUTE OF COMPUTER SCIENCE AND DIGITAL INNOVATION
ACADEMIC SESSION: SEPTEMBER 2023
BIC2333: MOBILE PROGRAMMING FOR IOS
COURSEWORK DEADLINE: 13th October 2023 by 5pm

INSTRUCTIONS TO CANDIDATES
1. This assignment will contribute 30% to your final grade.
2. This coursework is a individual assignment.
IMPORTANT
Plagiarism is not allowed, and any student found to commit such an act, 0 mark
will be awarded.
Coursework must be submitted on their due dates. If a coursework is submitted after
its due date, the following penalty will be imposed:
● ONE day late : 3 marks deducted from the total marks awarded.
● TWO days late : 5 marks deducted from the total marks awarded.
● THREE or more days late: Assignment will not be marked and 0% will be
awarded.
For example: A student scores 10 marks for an assignment that has a total mark of 10.
If the assignment is submitted one day late, the marks awarded will be 7 marks.
Description of Assignment
Project Requirement
Welcome to Solitaire Prime! This game uses one standard deck of cards. Here are
the rules:
1. Take the top card from the deck and place it face up on the table.
2. The Sum is now the value of that card (Ace = 1, 2 = 2, … 10 = 10, Jack = 10,
Queen = 10, King = 10)
3. If the Sum is a prime number, discard that pile (hand), and start over at
instruction #1
4. If the Sum is not prime, take the next card from the top of the deck and place
it on top of the card stack (pile or hand) on the table.
5. The Sum is now the sum of all cards in the stack on the table.
6. Go to instruction #3.
Continue to play the game, keeping track of how many piles you have created that
are prime.
If the last card from the deck gives you a prime pile, then you win! Write the word
“Winner” on the screen and show how many prime piles there were.
If the last card from the deck does not give you a prime pile, then you lose. Write the
word “Loser” in the screen.
You will have 2 classes:
? The Deck class which will create the deck of cards
? The Card class which creates cards
The main logic of the program will be in the main function. You will use the Card
class and the Deck class to play the game.
Here the methods you will need to create. Feel free to add more if you need them.
public class Deck
public Deck( ) // constructor which creates a deck of 52 cards. Ace of Spades on
top, followed by the rest of the spades in order, followed by Hearts, Diamonds and
Clubs.
public void refreshDeck(); // reset the deck so it looks like a new deck.
public Card deal( ) // deal a card from the top of the deck.
public void shuffle( ) // shuffle the cards in the deck.
public int cardsLeft( ) // return the number of cards left in the deck
public void showDeck( ); // show all the cards in the deck: 13 columns and 4 rows.
public class Card
public Card( ) // create a “blank” card
public Card ( char r, char s ) // constructor to create a card, setting the rank and
suit
public void setCard( char r, char s) // set an existing blank card to a particular
value
public int getValue( ) // return the point value of the card. Ace = 1, 2 thru 10, Jack =
10, Queen = 10, King = 10
public void showCard( ) // display the card using 2 fields… Ace of Spade:AS, Ten
of Diamond:10D, Queen of Heart:QH, Three of Club:3C. (If you want to get fancy,
you can use these symbols for the suit ?, ?, ?, ?)
In the main function, you will have a menu that looks like this:
Welcome to Solitaire Prime!
1. New Deck
2. Display Deck
3. Shuffle Deck
4. Play Solitaire Prime
5. Exit
New Deck will create an unshuffled deck in the following order: Spades, Hearts,
Diamonds, Clubs… Ace, 2, 3, …, 10, Jack, Queen, King
Display Deck will display all cards in a grid: 13 columns by 4 rows.
Shuffle Deck will randomly shuffle all cards in the deck.
Play Solitaire will play the game as described above.
Exit will exit the program.
You must create your own function to shuffle and you must create your own function
called “isPrime”. One is NOT a prime number. Note: You cannot used the libraries
provided by Swift.
Prepare a report/documentation. The documentation must include:
1. Introduction
2. Flowchart
3. Code (complete code)
4. Print Screens
5. Conclusion
Your project will be evaluated based on the following:
Areas Criteria Marks
Code ? Program works very well. There
may be a few mistakes but it
does not distract from the
overall program. Person is
satisfied with the program.
Instructor is satisfied with the
effort and the program
20
Documentation ? Report is organized, all the
contents are comprehensive
and thoughtful.
10
Submission Requirement:
You are required to submit the following files in CN:
1. A report in .pdf format
File name convention: CourseCode_Report_YourName.pdf
2. Source code folder
File name convention: CourseCode_YourName.pdf
You may zip both the files together and upload as one submission. The FORMAT of
the report should be in Font Name/Size: Times New Roman, 12pt; Line spacing of
1.5; Justified (Alignment); Page Number should be typed on the bottom right of the
page.
End of Assignment

相关文章

版权所有:留学生编程辅导网 2021,All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。