首页 > 编程语言 >RBE104TC C/C++ Programming Language

RBE104TC C/C++ Programming Language

时间:2024-10-29 17:00:23浏览次数:6  
标签:code your Language Programming should RBE104TC square round points

RBE104TC C/C++ Programming Language

Assignment 2

Contribution to the Overall Marks70%Issue DateSubmission Deadline3rd November 2024

Assignment Overview:

This assignment is geared towards assessing fundamental coding concepts in C/C++ andinitiating the process of code development using the software development process (SDP)discussed in relevant lectures.In composing the SDP report [in English], we request you to fulfil the following criteria:

  • Design: Clearly explain your understanding of the given problem and specify a sequence ofsteps necessary to accomplish the task (illustrated through flowcharts).
  • Coding Progress: Attach 3-5 screenshots that show the code and running results as evidence,particularly highlighting any errors or situations you believe are valuable to document. Thecorresponding 3-5 versions of the C code should also be saved. All files must clearlydemonstrate the progression of your programming task from the initial stage to the final version.(Multiple versions of C code are only required for the individual project)
  • Analysis: Describe the files submitted in the Coding Progress section. Discuss the expectedresults, any encountered or unexpected errors, and your solutions to those issues.
  • Implementation: The C code must be submitted in a separate file. Please specify the filename and provide instructions for user operation.
  • Testing: Describe how you tested and validated your code for required functionalities, aswell as its robustness.Exercise 1 (30%): Design a new class to represent a fraction (a combinationof two integer values). The data members of the classFraction are two ntegers, top and down, denoting thenumerator and denominator, respectively.

Part 1: Fundamental requirements for the class Fraction.

  1. Fractional numbers can be declared with both a numerator and denominator, or simplenumerator:
  1. Fractions should be able to act just like other numbers.Add, subtract, multiply, and divide;Compare based on values;Input and output.

Part 2: Advanced requirements

  1. Fractional number is normalized to ensure that only the numerator can be negative andthe value is in the least common denominator form:
  • 2/-3 would be converted into -2/3 automatically;
  • 15/21 would be converted into 5/7 automatically.
  1. Write methods to convert between decimals and fractions.

Exercise 2 (35%):

You're now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:

  • Integer (one round's score): Directly represents the number of points you get in this

round.

  • "+" (one round's score): Represents that the points you get in this round are the sum ofhe last two valid round's points.
  • "D" (one round's score): Represents that the points you get in this round are the doubleddata of the last valid round's points.
  • "C" (an operation, which isn't a round's score): Represents the last valid round's pointsyou get were invalid and should be removed.Each round's operation is permanent and could have an impact on the round before and theround after.You need to return the sum of the points you could get in all the rounds. Note:
  • The size of the input list will be between 1 and 1000.
  • Every integer represented in the list will be between -30000 and 30000.

Example:

  • Input: ["5","2","C","D","+"] Output: 30 Explanation:
  • Round 1: You could get 5 points. The sum is: 5.
  • Round 2: You could get 2 points. The sum is: 7.
  • Operation 1: The round 2's data was invalid. The sum is: 5.
  • Round 3: You could get 10 points (the round 2's data has been removed). The sum is: 15.
  • Round 4: You could get 5 + 10 = 15 points. The sum is: 30.

Exercise 3 (35%):

This is a Group Project!!! You are asked to program a game called Monopoly in C++. This game is played by two players (youand computer in this assignment). The game and its rules are described as the follows.

  • Account Setup:Each player must establish an account with a positive balance, starting with a deposit of 5000 units.This means that you have to set up a data base (a file) which records the players’ information, forexample, name, gender and account balance etc. and the program is supposed to be able to track thebalance changes as the game is going.
  • Game Board:This game is played on a game board as shown in Fig. 1, consisting of 38 squares. Each square,except for the four corner squares (the "GO" square, two "CASSINO" squares, and the "JAIL"square), 代 写RBE104TC C/C++ Programming Language has a price tag for ownership, with prices randomly generated within the range of 10 to 300.All players begin at the "GO" square, and each time a player passes the "GO" square, their accountbalance is increased by 200 units.
  • Gameplay Mechanics:You and the computer take turns to roll a dice. The outcome of each rolling (a random number withinthe range of 1 to 6) decides how many squares you/computercan advance in a clockwise directionon the board. After you have landed on a square:- if this square is unoccupied (so this means each square except “GO” and “JAIL” has anownership attribute): you can decide whether or not you should buy it;- if this square is occupied by you (you’ve already bought it), then nothing needs to be done;- if this square is occupied by your opponent and the adjacent squaresare unoccupied oroccupied by you: you will be fined by 10% of the square price;- if this square and one of its adjacent squares are both occupied by youropponent (whichmeans you opponent has purchased 2 consecutives squares): you will be fined by 20% of thesquare price;- The fine is topped at 20% of the square price even if more than 2 consecutive squares have been occupied by your opponent.
  • Special Squares:Landing on the "JAIL" square requires the player to wait for one round before moving again;Landing on a "CASSINO" square prompts the player to decide whether to gamble. If the playerdeclines, nothing happens. If the player accepts, they must place a bet, and the casino rolls a dice.The player must predict if the outcome will be greater than 3 or not. A correct prediction results ina reward of twice the bet, while an incorrect prediction results in the loss of the bet;
  • Game End Conditions:

The game ends under three scenarios:

- A player declares bankruptcy (balance is less than or equal to 0);

- A player's account balance exceeds 15,000 units;

- The player chooses to quit the game.Fig. 1 Game Board

Hint:

  1. The computer's logic can be straightforward. For example, it could continuously purchasesquares until it runs out of funds. Additionally, when landing on a "CASSINO" square, theomputer could gamble a fixed amount, such as 100 points, each time. Alternatively, thecomputer 's actions could be determined by pre-defined probabilities to introduce variability inits behavior.
  1. Employ the concept of Object-Oriented Design (OOD) to structure your game development.his involves utilizing distinct classes to encapsulate various aspects of the game. For instance,a Player class to manage player attributes and behaviors; a Map class to represent the gameboard and its properties, etc.What should be submitted?
  • You should submit the followings two:
  1. A concise report (with text spanning a few pages) accompanied by C source codes. Thisreport should delve into the specifics for each question:

- Detail SDP steps 1 to 3 within the report (Design + Coding Progress + Analysis),

accounting for 30% of the evaluation.

- Encompass SDP step 4 (Implementation + Robustness) with your source code. Your code

should correspond with the final screenshot provided in the Coding Progress section andinclude appropriate comments. Implementation contributes 35% whileRobustness adds5%.

- Elaborate on SDP step 5 (Testing), elucidating how you validated the correctness,robustness, and thoroughness of your codes. Employ screenshots and ample explanationsas verification, encompassing 20% of the evaluation.

- The overall quality of the report accounts for 10% of the evaluation.

  1. All C/C++ source code files, including files from different stages corresponding to thescreenshots.
  • For a comprehensive grading scheme, please consult the Marking Guidelines available onthe Learning Mall system.
  • The report must be saved in PDF format. Place the report in the same folder with source codefiles and compress the folder into a single zipped file. Your final submission should include:- Zipped file containing:

- The report

- The source codes

  • The naming convention for the submitted Report and source code files should adhere to the

subsequent format:

- StudentID_LastName_FirstName_AssignmentID.pdf

- StudentID_AssignmentNumber_ExerciseID_SSScreenShotNumber.c/cpp

- StudentID_LastName_FirstName_AssignmentID.zip

What should be submitted for Group Projects?

  1. A concise report, similar to the individual project report, to demonstrate their individualwork to the group project.
  1. Since different group members may be responsible for different code components, it is notrequired to submit multiple versions of the code. However, all code components, including ‘.c’,‘.cpp’, ‘.h’, or ‘.hpp’ files created by the entire group, should be placed in a single folder forsubmission. The folder should be named as follows:- StudentID_AssignmentNumber_ExerciseID
  1. An introduction file, saved in PDF format, that explains how to compile the submitted source code. This guide will be used to compile your source code for testing, and the testingresults will be used to assess the 'Implementation & Robustness' of the group project.
  1. A contribution statement signed by all group members. The format for this statement canbe found in the Marking Guidelines. It looks like:As an illustration: The report and C source files for individual projects, along with the folder for group projects,should be placed together in the same directory as follows:This directory should then be compressed into a final zipped submission file, named as follows:
  • 1234567_Albert_Einstein_2.zip

How the work should be submitted? Submission should take place electronically through the Learning Mall system, enabling us toexecute your software during the assessment. Additionally, feedback will be provided via thesame Learning Mall system.

标签:code,your,Language,Programming,should,RBE104TC,square,round,points
From: https://www.cnblogs.com/CSSE2310/p/18512879

相关文章

  • A Survey of Multimodal Large Language Model from A Data-centric Perspective
    本文是LLM系列文章,针对《ASurveyofMultimodalLargeLanguageModelfromAData-centricPerspective》的翻译。以数据为中心的多模态大型语言模型综述摘要1引言2背景和分类3数据收集和处理4以数据为中心的预训练5以数据为中心的自适应6评估7未来方......
  • A Survey of Generative Search and Recommendation in the Era of Large Language Mo
    本文是LLM系列文章,针对《ASurveyofGenerativeSearchandRecommendationintheEraofLargeLanguageModels》的翻译。大型语言模型时代的生成式搜索与推荐综述摘要1引言2传统范式3用于搜索和推荐的生成式范式4生成式搜索5生成式推荐6讨论7结论......
  • 2024CS 525 All SectionsProgramming
    AdvancedDatabaseOrganization-Fall2024CS525-AllSectionsProgrammingAssignmentIII:RecordManagerDue:Friday,October18th2024by23h59TaskThegoalofthisassignmentistoimplementasimplerecordmanager.Therecordmanagerhandlestablesw......
  • SubPT+NFL:Understanding and Mitigating Overfitting in Prompt Tuning for Vision-La
    当前提示学习的问题(a)Top:在CoOp和CoCoOp的训练过程中,基类的测试准确率先提高后下降。(b)底部:新类别的测试精度不断下降,远低于零样本CLIP。为什么CoOp会过度拟合根据第4-A节给出的观察结果,我们从早期和后期训练阶段({......
  • 论文翻译 | Bounding the Capabilities of Large Language Models in Open Text Gener
    摘要        开放式生成模型的局限性尚不清楚,但却越来越重要。是什么让他们成功,又是什么让他们失败?在本文中,我们采用了一种以提示为中心的方法来分析和限定开放式生成模型的能力。我们提出了两种具有挑战性的提示约束类型的通用分析方法:结构和风格。这些约束类型被归......
  • Grounded Language-Image Pre-training
    论文《GLIP:GroundedLanguage-ImagePre-Training》提出了一种新的基于语言和图像的预训练模型,旨在学习语义丰富、语言感知的视觉表示。其核心思想是统一对象检测和短语定位两种任务,从而提升模型在视觉和语言理解任务上的表现。以下是这篇论文的主要内容总结:任务介绍传......
  • 论文翻译 | Scalable Prompt Generation for Semi-supervised Learning with Language
    摘要         基于提示的学习方法在半监督学习(SSL)设置中已被文献证明在多个自然语言理解(NLU)数据集和任务上有效。然而,手动设计多个提示和表述词需要领域知识和人力投入,这使得在不同数据集上扩展变得困难且昂贵。在本文中,我们提出了两种方法来自动设计多个提示,并在......
  • MYSQL-SQL-01-DDL(Data Definition Language,数据定义语言)
    DDL(数据定义语言)DDL(DataDefinitionLanguage),数据定义语言,用来定义数据库对象(数据库,表,字段)。一、数据库操作1、查询mysql数据库管理系统的所有数据库语法:showdatabases;示例:2、查询当前所在的数据库语法:selectdatabase();示例:3、创建数据库语法:([]括号......
  • 2022 International Collegiate Programming Contest, Jinan Site
    2022InternationalCollegiateProgrammingContest,JinanSiteK.StackSort题意给一个从1到n的排序,按顺序把这些数压入m个栈全部入栈后,每次选择一个栈,把数字全部弹出再换下一个要求弹出顺序是升序的思路发现要把\(x\)和\(x-1\)压入同一个栈,这样出栈才能按顺序可以......
  • STAR: A Simple Training-free Approach for Recommendations using Large Language M
    目录概符号说明STARRetrievalRanking最后的结果LeeD.,KraftA.,JinL.,MehtaN.,XuT.,HongL.,ChiE.H.andYiX.STAR:Asimpletraining-freeapproachforrecommendationsusinglargelanguagemodels.2024.概本文提出了一种融合语义/协同/时序信息的方法,......