Visual Basic/C# Programming (330)

Similar documents
Visual Basic/C# Programming (330)

JAVA PROGRAMMING (340)

Visual Basic/C# Programming (330)

JAVA PROGRAMMING (340)

6 Pages Contestant Number Time Rank. Regional 2013 TOTAL POINTS (485)

VISUAL BASIC PROGRAMMING (44) Technical Task KEY. Regional 2013 TOTAL POINTS (485)

Class Test 4. Question 1. Use notepad to create a console application that displays a stick figure. See figure 1. Question 2

CALCULATOR APPLICATION

Click on the empty form and apply the following options to the properties Windows.

You can call the project anything you like I will be calling this one project slide show.

CSIS 1624 CLASS TEST 6

Main Game Code. //ok honestly im not sure, if i guess its a class ment for this page called methodtimer that //either uses the timer or set to timer..

Form Properties Window

Class Test 3. Question 1

Start Visual Studio, create a new project called Helicopter Game and press OK

Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK.

IBSDK Quick Start Tutorial for C# 2010

We are going to use some graphics and found a nice little batman running GIF, off course you can use any image you want for the project.

The first program we write will display a picture on a Windows screen, with buttons to make the picture appear and disappear.

Object oriented lab /second year / review/lecturer: yasmin maki

Skill Area 336 Explain Essential Programming Concept. Programming Language 2 (PL2)

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:

Experiment 5 : Creating a Windows application to interface with 7-Segment LED display

Eyes of the Dragon - XNA Part 37 Map Editor Revisited

Now find the button component in the tool box. [if toolbox isn't present click VIEW on the top and click toolbox]

if (say==0) { k.commandtext = "Insert into kullanici(k_adi,sifre) values('" + textbox3.text + "','" + textbox4.text + "')"; k.

} } public void getir() { DataTable dt = vt.dtgetir("select* from stok order by stokadi");

To start we will be using visual studio Start a new C# windows form application project and name it motivational quotes viewer

Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic

Tutorial 5 Completing the Inventory Application Introducing Programming

First start a new Windows Form Application from C# and name it Interest Calculator. We need 3 text boxes. 4 labels. 1 button

Using Visual Basic Studio 2008

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them.

Start Visual Studio and create a new windows form application under C# programming language. Call this project YouTube Alarm Clock.

LESSON B. The Toolbox Window

Huw Talliss Data Structures and Variables. Variables

Create your own Meme Maker in C#

// Specify SEF file to load. oschema = (edischema) oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below.

Class Test 4. Question 1. Use notepad to create a console application that displays a face. See figure 1. Figure 1. Question2

Representing Recursive Relationships Using REP++ TreeView

Conventions in this tutorial

UNIT-3. Prepared by R.VINODINI 1

// Specify SEF file to load. edischema oschema = oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

Visual C# Program: Simple Game 3

// Program 2 - Extra Credit // CIS // Spring // Due: 3/11/2015. // By: Andrew L. Wright. //Edited by : Ben Spalding

Unit 1 Workbook ICS3U

Step 1: Start a GUI Project. Start->New Project->Visual C# ->Windows Forms Application. Name: Wack-A-Gopher. Step 2: Add Content

Microsoft Visual Basic 2005: Reloaded

Advanced Programming C# Lecture 2. dr inż. Małgorzata Janik

Developing for Mobile Devices Lab (Part 1 of 2)

RegEx - Numbers matching. Below is a sample code to find the existence of integers within a string.

Classes in C# namespace classtest { public class myclass { public myclass() { } } }

CIS 3260 Intro. to Programming with C#

Fast Food Store Group Boxes and Other User Controls

Writing Your First Autodesk Revit Model Review Plug-In

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614. DATE: 5 March 2015 MARKS: 100 SECTION A (36)

string spath; string sedifile = "277_005010X228.X12"; string sseffile = "277_005010X228.SemRef.EVAL0.SEF";

Chapter 2. Ans. C (p. 55) 2. Which is not a control you can find in the Toolbox? A. Label B. PictureBox C. Properties Window D.

II. Programming Technologies

بسم هللا الرحمن الرحيم المحاضرة السابعة مستوى ثالث علوم حاسوب برمجة مرئية 2 )عملي ) جامعة الجزيرة محافظة اب الجمهورية اليمنية النافذة الرئيسية

FUNDAMENTAL SPREADSHEET APPLICATIONS (230)

FDSc in ICT. Building a Program in C#

Chapter 6 Dialogs. Creating a Dialog Style Form

Flag Quiz Application

// Precondition: None // Postcondition: The address' name has been set to the // specified value set;

Final Exam 7:00-10:00pm, April 14, 2008

NI USB-TC01 Thermocouple Measurement Device

Rock-Paper-Scissors Multiple versions Nested If / Else If / Else Random Numbers

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics.

Sub To Srt Converter. This is the source code of this program. It is made in C# with.net 2.0.

Chapter 8 Advanced GUI Features

Hands-On Lab. Lab: Client Object Model. Lab version: Last updated: 2/23/2011

Inheriting Windows Forms with Visual C#.NET

C# winforms gridview

CSC 355 PROJECT 4 NETWORKED TIC TAC TOE WITH WPF INTERFACE

Activating AspxCodeGen 4.0

RegEx-validate IP address. Defined below is the pattern for checking an IP address with value: String Pattern Explanation

IN COLLABORATION WITH IVTB. Diploma in Information Technology. Examinations for / Semester 2

เว บแอพล เคช น. private void Back_Click(object sender, EventArgs e) { this.webbrowser2.goback(); }

Name: Lindsay Haley Assignment: Ch.6 case 9. Design Steps of the Program Development Life Cycle

namespace csharp_gen277x214 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

Class Test 5. Create a simple paint program that conforms to the following requirements.

Programming in C# Project 1:

XNA 4.0 RPG Tutorials. Part 24. Level Editor Continued

Bachelor s Thesis: Building Web Application for Mahabad University Graduate Affairs Afsaneh Nezami Savojbolaghi

The Gracefulness of the Merging Graph N ** C 4 with Dotnet Framework

Savoy ActiveX Control User Guide

Hands-On Lab (MBL04) Lab Manual Incorporating COM Objects into Your.NET Compact Framework 2.0 Application

Brian Kiser November Vigilant C# 2.5. Commonwealth of Kentucky Frankfort, Kentucky

Decision Structures. Start. Do I have a test in morning? Study for test. Watch TV tonight. Stop

namespace Gen837X222A1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

Introduction. Create a New Project. Create the Main Form. Assignment 1 Lights Out! in C# GUI Programming 10 points

namespace Tst_Form { private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components;

This is the start of the server code

Engr 123 Spring 2018 Notes on Visual Studio

C:\homeworks\PenAttention_v13_src\PenAttention_v13_src\PenAttention4\PenAttention\PenAttention.cs 1 using System; 2 using System.Diagnostics; 3 using

Visual Basic 2008 Anne Boehm

In-Class Worksheet #4

Transcription:

Page 1 of 16 Visual Basic/C# Programming (330) REGIONAL 2016 Program: Character Stats (400 points) TOTAL POINTS (400 points) Judge/Graders: Please double check and verify all scores and answer keys! Property of Business Professionals of America. May be reproduced only for use in the Business Professionals of America Workplace Skills Assessment Program competition.

Page 2 of 16 General Instructions You work for XYZ Games, Inc., a company that develops multiple video games. You have been asked to develop a GUI application that will calculate character statistics. Your deliverable for this project must include the following. 1. Create a multi-form GUI application. 2. The startup form, Main Form, must resemble Figure 1. 3. The second form, the Hero Form, must resemble Figure 2. 4. The application must adhere to proper naming conventions and include the required methods and functionality as mentioned in the specifications. NOTES TO CONTESTANT You will have 90 minutes to complete your work. Your name and/or school name should not appear on any work you submit for grading. Copy your entire solution/project to the flash drive provided. You must submit your entire solution/project so that the graders may open your project to review the source code. You must ensure that the files required to run your program are present and will execute on the flash drive provided. Note that the flash drive letter may not be the same when the program is graded as it was when you created the program. It is recommended that you use relative paths rather than absolute paths to ensure that the program will run regardless of the flash drive letter. The graders will not compile or alter your source code to correct for this. Submissions that do not contain source code will not be graded. The flash drive that you are provided must have three (3) pictures files for you. The files are: archer.png warrior.png wizard.png

Page 3 of 16 Your application will be graded on the following criteria: Solution and Project The project is present on the flash drive The project is named according to the naming conventions Three (3) Character images are added to the project as Resources User Interface Design Main Form The Main Form resembles Figure 1 25 points The name of the form is, frmmain The form s caption displays Contestant #01-2345-6789, where #01-2345-6789 is the contestant s properly formatted BPA ID The user interface contains a label explaining Heroes The user interface contains a button named, btnhero The user interface contains a button captioned, Hero The user interface contains a label explaining Villains The user interface contains a button named, btnvillain The user interface contains a button captioned, Villain The user interface contains a button named, btnexit The user interface contains a button captioned, E&xit Hero Form The Hero Form resembles Figure 2 The name of the form is, frmhero The form s caption displays Hero Stats Listbox for hero characters name lsthero Listbox for hero characters is not pre-populated PictureBox is implemented and image is not pre-populated Groupbox for skill level is populated with correct skill levels Groupbox for character stats is populated with the correct attributes A button named, btncalculate, is defined A button captioned, &Calculate, is defined A button name, btnback, is defined A button captioned, &Back to Side Selector, is defined 25 points 15 points 15 points

Page 4 of 16 Runtime Checks Code copied to USB drive and program runs from the USB drive If the program does not execute, then the remaining items in this section receive a score of zero When the Hero button is clicked, the Hero Form is displayed When the Villain button is clicked, a coming soon message is displayed When the user attempts to close the application, a confirmation dialog is presented that confirms that the user wishes to exit the application User is prompted if they did not select a hero from Hero Listbox Application correctly calculates character s individual stats and total XP 25 points 10 points 15 points 10 points 25 points Source Code Review Code is commented at the top, for each function, and as needed Code uses consistent variable naming conventions Main Form An instance of the Hero Form is created and displayed on click of Hero button Hero Form A method called, ResetValues(), is utilized to reset all controls A method called, CalcHeroLevels(), is utilized to calculate the appropriate character stats based on the Skill Level selected CalcHeroLevels() method displays the strength, speed, armor, magic, and total XP to the appropriate labels PictureBox image is assigned via code when Hero Listbox item is selected 15 points 10 points 20 points 20 points 20 points 15 points 20 points Total: 400 points

Page 5 of 16 Technical Specifications 1. Solution and Project a. Create a Windows Form Application named 330_ContestantNumber, where ContestantNumber is your BPA assigned contestant number. When naming your project, replace dashes (-) with the underscore (_). For example, if your BPA contestant number is 01-2345-6789, then your project name would be 330_01_2345_6789. 2. User Interface a. The user interface to be constructed is shown in Figure 1 and Figure 2. Your application must resemble the prototype (see Figure 1 and Figure 2). b. The Main Form i. The name of the main form should be frmmain. ii. The Form s caption must be set to Contestant #01-2345-6789, where 01-2345-6789 is your BPA assigned contestant number (including dashes). iii. User interface elements and default (design-time) property settings 1. Exit Button a. The name of this button must be cmdexit b. The text property for this button must be set to E&xit 2. Hero Button a. The name of this button must be btnhero b. The text property for this button must be set to &Hero 3. Villain Button a. The name of this button must be btnvillain b. The text property for this button must be set to &Villain 4. Group Box a. A group box called, grpselectside must be created b. The group box must have the caption Select a Side c. The Hero Form i. The name of the main form should be frmhero. ii. The Form s caption must be set to Hero Stats. iii. User interface elements and default (design-time) property settings 1. Hero Listbox a. The name of this listbox must be lsthero b. The list box should be populated with three choices: i. Archer ii. Warrior iii. Wizard 2. PictureBox a. The name of this picture box must be pichero

Page 6 of 16 b. Sizemode should be set to StretchImage c. The PictureBox image will set via code when a character is selected from the Hero listbox. 3. Skill Level Group Box a. Group box is populated with radio buttons with the following names and text properties i. Level 1, radlevel1 ii. Level 10, radlevel10 iii. Level 25, radlevel25 iv. Level 50, radlevel50 v. Level 75, radlevel75 vi. Level 99, radlevel99 b. The group box must have the caption Select a skill level 4. Character Stats Group Box a. Group box is populated with labels for the following: i. Strength ii. Speed iii. Armor iv. Magic v. Total XP b. The group box must have the caption Character Stats 5. Back to Side Selector Button a. The name of this button must be btnback b. The text property for this button must be set to &Back to Side Selector 6. Calculate Button a. The name of this button must be btncalculate b. The text property for this button must be set to &Calculate 3. Tasks a. Main Form - Exit Button Click i. Closes the form. Upon closing, the application must confirm that the form is to be closed and allow the user to cancel the close by responding with No to the question, Do you wish to exit this application? If the user responds with a Yes, then the application is closed. ii. The message box used to solicit the response must contain the message, Do you wish to exit this application? with a caption of Exit? iii. The dialog box used to solicit the response must contain two buttons: Yes and No.

Page 7 of 16 b. Main Form - Hero Button Click i. Open the Hero Form (frmhero) c. Main Form - Villain Button Click i. Display a message to the user with the following message: Coming soon: Select a villain (see Figure 3). d. Hero Form Calculate Button Click i. This procedure must validate whether or not a hero has been selected. If the user did not select a hero yet, a message should prompt the user. ii. Upon click, a method named CalcHeroLevels is called. 1. This method will calculate all of the character stats for the selected hero and skill level (see Figure 4 for a table of hero base stats) 2. If a character is not selected from the Hero Listbox, the user should be prompted to select a character. Stats should not display if a character has not been selected. 3. The total XP (Experience Points) is calculated by added the strength, speed, armor, and magic attributes. 4. The stats for each attribute are based on a multiplier in the following list (for example, a Level 10 Warrior would have each attribute multiplied by 2): Level 1 1x multiplier Level 10 2x multiplier Level 25 3x multiplier Level 50 4x multiplier Level 75 5x multiplier Level 99 6x multiplier e. Hero Form Back to Side Selector Button i. Closes the Hero form f. Hero Listbox Selection i. Upon selecting a hero from lsthero, a method called ResetValues() must be called. 1. ResetValues() should reset the skill Level to Level 1 and all character stats should be reset to empty strings. ii. Upon selecting a hero from lsthero, the correct image should populate in the pichero picture box Reminder: the images are on the USB provided to you. If images were not provided, please contact the contest Administrator. The images must be added to the project as a resource.

Page 8 of 16 Figure 1 Figure 2 Figure 3

Page 9 of 16 Attribute (Level 1 Stats) Archer Warrior Wizard Strength 100 150 200 Speed 145 115 400 Armor 80 120 100 Magic 100 90 600 Figure 4 Hero base stats Development Standards Standard name prefixes must be utilized for forms, controls, and variables. All subroutines, functions, and methods must be documented with comments explaining the purpose of the method, the input parameters (if any), and the output (if any). The user interface must be similar to Figure 1 and 2. Example Scenarios Archer on Level 1 Warrior on Level 50

Page 10 of 16 *************************************************************************************** Visual Basic Source Sample *************************************************************************************** frmmain.vb Public Class frmmain Private Sub btnhero_click(sender As Object, e As EventArgs) Handles btnhero.click ' Create an instance of the HeroForm form. Dim frmhero As New frmhero ' Show the IndividualForm form. frmhero.showdialog() End Sub Private Sub btnvillian_click(sender As Object, e As EventArgs) Handles btnvillian.click 'Message: under construction MessageBox.Show("Coming soon: Select a villian.") End Sub Private Sub btnexit_click(sender As Object, e As EventArgs) Handles btnexit.click ' Close the MainForm form. 'Asks for confirmation, if result is yes then close If (MessageBox.Show("Do you wish to exit this application?", "Confirm Exit", MessageBoxButtons.YesNo) = DialogResult.Yes) Then Me.Close() End If End Sub End Class frmhero.vb Public Class frmhero Dim intstrength As Integer Dim intspeed As Integer Dim intarmor As Integer Dim intmagic As Integer Private Sub btncalculate_click(sender As Object, e As EventArgs) Handles btncalculate.click If lsthero.selectedindex <> -1 Then ResetValues() CalcHeroLevels() Else MessageBox.Show("You must first select a hero") End If End Sub

Page 11 of 16 Private Sub lsthero_selectedindexchanged(sender As Object, e As EventArgs) Handles lsthero.selectedindexchanged ResetValues() End Sub Sub CalcHeroLevels() If lsthero.selectedindex <> -1 Then ' Display the totals. If radlevel1.checked = True Then ElseIf radlevel10.checked = True Then intstrength = intstrength * 2 intspeed = intspeed * 2 intarmor = intarmor * 2 intmagic = intmagic * 2 ElseIf radlevel25.checked = True Then intstrength = intstrength * 3 intspeed = intspeed * 3 intarmor = intarmor * 3 intmagic = intmagic * 3 ElseIf radlevel50.checked = True Then intstrength = intstrength * 4 intspeed = intspeed * 4 intarmor = intarmor * 4 intmagic = intmagic * 4 ElseIf radlevel75.checked = True Then intstrength = intstrength * 5 intspeed = intspeed * 5 intarmor = intarmor * 5 intmagic = intmagic * 5 ElseIf radlevel99.checked = True Then intstrength = intstrength * 6 intspeed = intspeed * 6 intarmor = intarmor * 6 intmagic = intmagic * 6 Else MessageBox.Show("You must select a level") End If End Sub lblstrength.text = intstrength.tostring() lblspeed.text = intspeed.tostring() lblarmor.text = intarmor.tostring() lblmagic.text = intmagic.tostring() lbltotal.text = (intstrength + intspeed + intarmor + intmagic).tostring() Else MessageBox.Show("You must select a hero before calculating total XP.") End If Sub ResetValues() If lsthero.selectedindex = 0 Then pichero.image = My.Resources.archer intstrength = 100 intspeed = 145

Page 12 of 16 intarmor = 80 intmagic = 100 ElseIf lsthero.selectedindex = 1 Then pichero.image = My.Resources.warrior intstrength = 150 intspeed = 115 intarmor = 120 intmagic = 90 ElseIf lsthero.selectedindex = 2 Then pichero.image = My.Resources.wizard intstrength = 200 intspeed = 400 intarmor = 100 intmagic = 600 Else End If End Sub Private Sub btnclose_click(sender As Object, e As EventArgs) Handles btnback.click Me.Close() End Sub End Class *************************************************************************************** C# Source Sample *************************************************************************************** frmmain.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CharacterStats public partial class MainForm : Form public MainForm() InitializeComponent(); private void btnhero_click(object sender, EventArgs e)

Page 13 of 16 //Create an instance of the HeroForm form. HeroForm frmhero = new HeroForm(); //Show the IndividualForm form. frmhero.showdialog(); private void btnexit_click(object sender, EventArgs e) this.close(); private void btnvillian_click(object sender, EventArgs e) //Message: under construction MessageBox.Show("Coming soon: Select a villian"); frmhero.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CharacterStats public partial class HeroForm : Form private int intstrength; private int intspeed; private int intarmor; private int intmagic; private int inttotal; public HeroForm() InitializeComponent(); private void btncalculate_click(object sender, EventArgs e) if (lsthero.selectedindex!= -1) ResetValues(); CalcHeroLevels();

Page 14 of 16 else MessageBox.Show("You must first select a hero"); private void lsthero_selectedindexchanged(object sender, EventArgs e) ResetValues(); void CalcHeroLevels() if (lsthero.selectedindex!= -1) //Display the totals. if (radlevel1.checked == true) else if (radlevel10.checked == true) intstrength = intstrength * 2; intspeed = intspeed * 2; intarmor = intarmor * 2; intmagic = intmagic * 2; else if (radlevel25.checked == true) intstrength = intstrength * 3; intspeed = intspeed * 3; intarmor = intarmor * 3; intmagic = intmagic * 3; else if (radlevel50.checked == true) intstrength = intstrength * 4; intspeed = intspeed * 4; intarmor = intarmor * 4; intmagic = intmagic * 4; else if (radlevel75.checked == true) intstrength = intstrength * 5; intspeed = intspeed * 5; intarmor = intarmor * 5; intmagic = intmagic * 5; else if (radlevel99.checked == true)

Page 15 of 16 intstrength = intstrength * 6; intspeed = intspeed * 6; intarmor = intarmor * 6; intmagic = intmagic * 6; else MessageBox.Show("You must select a level"); lblstrength.text = intstrength.tostring(); lblspeed.text = intspeed.tostring(); lblarmor.text = intarmor.tostring(); lblmagic.text = intmagic.tostring(); lbltotal.text = (intstrength + intspeed + intarmor + intmagic).tostring(); else MessageBox.Show("You must select a hero before calculating total XP."); void ResetValues() if (lsthero.selectedindex == 0) pichero.image = CharacterStats.Properties.Resources.archer; intstrength = 100; intspeed = 145; intarmor = 80; intmagic = 100; else if (lsthero.selectedindex == 1) pichero.image = CharacterStats.Properties.Resources.warrior; intstrength = 150; intspeed = 115; intarmor = 120; intmagic = 90; else if (lsthero.selectedindex == 2) pichero.image = CharacterStats.Properties.Resources.wizard; intstrength = 200; intspeed = 400; intarmor = 100; intmagic = 600; else

Page 16 of 16 private void btnclose_click(object sender, EventArgs e) this.close();