Link to Sample Exam Part I
Link to Sample Exam Part II
Solution to sample test programming problem two in Part II
Link to Sample Final Exam Part I
Link to Sample Final Exam Part II
Lab Assignment Guidelines
All homework assignments will only be accepted on any electronic media consisting of the following:
- Media should contain only executable program files, one for each of the exercises assigned.
- Name the files, 3_1.exe, 3_2.exe, 3_3.exe, etc.
- No other files should be on the disk unless specifically needed for the program to run...such as a .txt file.
- You must pretest the executable files before hand to make certain they run. Any that cannot be run from clicking their icon will be automatically given a zero grade.
- Any file which isn't in ".exe" format will be given a failing grade on that particular portion of the lab (Allowed ONE source code file from VS.NET).
- Interface style counts! Make sure you title all forms and dialogs. Use proper case at all times. Watch for "dead space" on your forms. Align buttons, labels, textboxes etc. Place checkboxes and option buttons in groups, etc.
The only exceptions to these rules is when the assignment specifically asks for something else (See bullet 3). For example, I may have you turn in your source code or SQL statements for certain lab assignments
Lab Assignment 1
3_1) In retail sales, management needs to know the average inventory figure and the turnover of merchandise. Create a project that allows the user to enter the beginning inventory, the ending inventory, and the cost of goods sold.
Form: Include labeled text boxes for the beginning inventory, the ending inventory, and the cost of goods sold. After calculating the answers, display the average inventory and the turnover formatted in text boxes.
Include buttons for Calculate, Clear, and an Exit menu choice located in a menu strip according to Windows’ standards. The formulas for the calculations are:
Average inventory = Beginning inventory + Ending inventory
Turnover = Cost of goods sold
Note: The average inventory is expressed in dollars; the turnover is the number of times the inventory turns over.
Code: Include procedures for the click event of each button. Display the results in text boxes. Format the average inventory as currency and the turnover as a number with one digit to the right of the decimal. Include error trapping (i.e., Try/Catch statements see my sample code) which displays an error message to the user.
Cost of Goods sold
3_2) A local recording studio rents its facilities for $200 per hour. Management charges only for the number of minutes used. Create a project in which the input is the name of the group and the number of minutes it used in the studio. Your program calculates the appropriate charges, accumulates the total charges for all groups, and computes the average charge and the number of groups that used the studio.
Form: Use labeled text boxes for the name of the group and the number of minutes used. The charges for the current group should be displayed formatted in a text box. Create a group box for the summary information. Inside the group box, display the total charges for all groups, the number of groups, and the average charge per group. Format all output appropriately. Include buttons for Calculate, Clear, and an Exit menu choice located in a menu strip according to Windows’ standards.
Code: Use a constant for the rental rate per hour; divide that by 60 to get the rental rate per minute. Make sure to catch any bad input data and display a message to the user (see 3_1).
Total Charges for Group
Total Number of Groups
Total Charges for All Groups
3_3) Create a project that calculates the total of fat, carbohydrates, and protein calories. Allow the user to enter (in text boxes) the grams of fat, the grams of carbohydrates, and the grams of protein. Each gram of fat is nine calories; a gram of protein or carbohydrates is four calories
Display the total calories for the current food items in a text box. Use two other text boxes to display an accumulated sum of the calories and a count of the items entered.
Form: The form should have three text boxes for the user to enter the grams for each category. Include labels next to each text box indicating what the user should enter. Include buttons to Calculate, to Clear the text boxes, and an Exit menu choice located in a menu strip according to Windows’ standards.
Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements see my sample code) which displays an error message to the user (See 3_1)
3_4) Create a project that calculates the shipping charge for a package if the shipping rate is $0.12 per ounce.
Form: Use labeled text boxes for the package identification code (a six-digit code) and the weight of the package. Use one text box for pounds and another for ounces. Use a text box to display the shipping charge. Include buttons for Calculate, Clear, and an Exit menu choice located in a menu strip according to Windows’ standards.
Code: Include event-driven methods for each button click. Use a constant for the shipping rate, calculate the shipping charge, and display it formatted in a text box. Make sure to catch any bad input data and display a message to the user (see 3_1).
Hint: There are 16 ounces to a pound.
0 lb. 5 oz.
2 lb. 0 oz.
1 lb. 1 oz.
3_5) David McDonald, owner of McDonalds Cut-Rate Bail Bonds, needs to calculate the amount due for setting bail. David requires the client post something of value for collateral, and his fee is 10% of the bail amount. He wants the user to have text boxes to enter the bail amount and the item being used for collateral. The program must calculate the fee.
Form: Include text boxes for entering the amount of the bail and the description of the collateral. Label each text box. Include buttons for Calculate, Clear, and an Exit menu choice located in a menu strip according to Windows standards. The text property of the form should read: Daves Bail Bonds.
Code: Include event-driven methods for the click event of each button. Calculate the amount due as 10% of the bail amount and display it in a text box, formatted as currency. Make sure to catch any bad input data and display a message to the user (See 3_1).
Lab Assignment 2
4_1) Dolly Barton owns an image consulting shop. Her clients can select from the following services at the specified regular prices: Makeover $125, Hair Styling $60, Manicure $35, and Permanent Makeup $200. She has distributed discount coupons that advertise discounts of 10 percent and 20 percent off the regular price. Create an application that will allow the receptionist to select a discount rate of 10 percent, 20 percent, or none, and then select a service. Display the price for the individual service and the total due after each visit is completed. A visit may include several services. Include buttons to Calculate, to Clear the text boxes, and an Exit menu choice located in a menu strip according to Windows’ standards.
Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user.
4_2) Modify the prior exercise to allow for sales to additional patrons. Include buttons for Next Patron and Summary. When the receptionist clicks the Summary button, display in a summary message box the number of clients and the total dollar value for all services rendered. For Next Patron, confirm that the user wants to clear the totals for the current customer.
4_3) Create a program to compute your checking account balance.
Form: Include radio buttons to indicate the type of transaction: deposit, check, or service charge. A textbox will allow the user to enter the amount of the transaction. Display the new balance in a ReadOnly textbox or a label. Calculate the balance by adding deposits and subtracting service charges and checks. Include buttons to Calculate, to Clear the text box(s) (depending on your design...the read-only textbox should NOT be cleared), and an Exit menu choice located in a menu strip according to Windows’ standards. You can't allow someone to withdraw money if they don't have it in their accounts!
Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user.
4_6) (Use “switch...case”) Piecework workers are paid by the piece. Workers who produce a greater quantity of output are often paid at a higher rate.
Form: Use textboxes to obtain the person’s name and the number of pieces completed. Include a Calculate button to display the dollar amount earned. You will need a Summary button to display the total number of pieces, the total pay, and the average pay per person. A Clear button should clear the name and the number of pieces for the current employee and a Clear All button should clear the summary totals after confirming the operation with the user.
Include validation to check for missing data. If the user clicks on the Calculate button without first entering a name and the number of pieces, display a MessageBox. Also, you need to make sure to not display a summary before any data are entered; you cannot calculate an average when no items have been calculated. You can check the number of employees in the Summary event-driven method or disable the Summary button (use the button's enable property in your code) until the first order has been calculated.
Include an Exit menu choice located in a menu strip according to Windows’ standards.
Code: Write the code for each button. Include error trapping (i.e., Try/Catch statements…see my sample code) which displays an error message to the user.
Price Paid per Piece for All Pieces
600 or more
4_8) Create an application to calculate sales for Castelano’s Catering. The program must determine the amount due for an event-driven method based on the number of guests, the menu (i.e., a food menu, not a Windows menu) selected, and the bar options. Additionally, the program maintains summary figures for multiple events.
Form: Use a textbox to input the number of guests and radio buttons to allow a selection of Prime Rib, Chicken, or Pasta. Check boxes allow the user to select an Open Bar, and/or Wine with Dinner. Display the amount due for the event in a label or a ReadOnly texbox. Include buttons to Calculate, to Clear the text box, and an Exit menu choice located in a menu strip according to Windows’ standards.
Rates per Person
Wine with dinner
Lab Assignment 3
7_1) Write a program which will read in the text file, Grades.txt (you'll have to remove it from the .zip file). Take each grade listed in the text file and place it in an integer array. Count how many entries there were in the text file. Then, compute the average of all the grades. The instructor has assigned a curve based on a standard deviation. Thus, the usual number to letter conversion does not apply. The grading scheme you are to use for this problem is:
91-100 = A
81-90 = B
71-80 = C
56-70 = D
0 - 55 = F
Finally, using a listbox, output each numeric score and show the letter grade in a column next to it. The first line should list the number of exams, the second line should list the Mean. Then create a column that lists the numeric score with a column listing the letter grade next to it. A sample output screen is shown in Figure 1 below.
7_2) Create a solution to analyze an income survey. The statistics for each home include an identification code, the number of members in the household, the yearly income, and the state of residence.
A menu will contain File, Reports, and Help. The File menu will contain Enter Data and Exit. As the data are entered, they should be assigned from the text boxes to the elements of the four arrays, one each for ID code, household members, yearly income, and state.
The reports for this solution will be sent to a listbox for your report and include the following:
(a) Average income.
(b) The percentage of households having incomes below the poverty level ($17,650).
(c) Four columns displaying the input data retrieved from the four arrays
7_3) Write a program that will allow a user to enter the first and last names of people in his or her class. Also show a textbox that will allow this user to indicate how many names they intend to capture. You may use this value in a size integer variable. This variable may then be used for two purposes: 1) to set the size of the array; and 2) to use in a loop to process your array for output. Use textboxFirstName and textboxLastName for data entry. Each of these values should be stored in two different arrays. Two buttons should be used: one labeled “Enter Name;” and the second labeled Display Classmates. The first button should be used for the data entry. The second button should send all names captured in the array to a listbox for output.
5 POINTS EXTRA CREDIT - If you create a third button that brings up a Save dialog box which allows the user to create and WRITE the output to a text file with the name of the text file provided by the user in the Save dialog box.
7_4) Download the Presidents.txt file (it’s in the .zip file). Have your program read the file and place the names of each president in an array. The list of presidents should be placed randomly in two comboboxes, each containing a different randomized list of presidents. These comboboxes will be populated from the array of presidents you’ve created from your file read. Make sure that you do not repeat any of the presidents’ names in the comboboxes.
The user selects a president from the first combobox and a different president from the second combobox. Then, the program logic should allow the user to guess which president served first…the one chosen from the first combobox or the one from the second combobox. You should then use a messagebox for output.
If the user guessed incorrectly, the messagebox should tell the user they’re incorrect, try again, and then reset the program for a new round of guessing.
If the user guesses correctly, the messagebox should read something like, “You are correct! John Adams (or whatever their correct choice was), the 2nd president served before John Quincy Adams, the 6th president.” Then, reset the program for another set of guesses.
Note: The ComboBox has a “listIndex” property that is a zero-based index of all entries in the combobox. There is also a "selectedindex" which indicates a user's choice. E.g., iff the user clicked on the fourth entry in a combobox, the combobox.selectedIndex property would return the value 3. These two properties may be helpful when writing this program. Read about it in your book.
7_5) Use a two dimensional array to populate a logical multiplication table in a business tier (Note: you will not show the table shown in Figure 2…this table will be held in memory after you populate it). In the example below, I’ve indicated what each array index would be for each cell of the table as well as the actual value. The outer numbers are not part of the table…they simply show what you’d get if you multiply 4 x 6, for example.
Figure 2 – Multiplication Table
Your presentation tier should allow the user to enter in two numbers, 1 through 9 (make sure your code limits their entry) into two texboxes. These numbers will be passed into the business tier to find the correct indices to return back to the presentation tier the correct result of the multiplication. Since this would be an easy problem to avoid using a business tier (as well as an array), I want you to copy the business tier code and paste it into an MS Word document which you will turn in with your lab assignment.
Although you can create the business tier methods any way you wish, I would suggest you may want to use two methods; one, a private method that creates the table and two, a method that is public, gets the numbers the user want to multiply and returns the answer. This public method would have to invoke the private method which creates the table. Again, you don’t have to do it this way!
Lab Assignment 4
13_1) Write a C# program that will display CustomerID, CompanyName, ContactName, Address, City, Postal Code, Country, Phone, and Fax from the “Customers” table found in the CIS3260 database on the Hooch server (Do not accidentally use the “Customer” table…this is a different table and will not be used in this assignment).
Use labels and texboxes with a good interface on the form. Modify labels that are not standard GUI labels; e.g., the CustomerID field is from the database. A user should see two separate words separated by a space for this and other similar fields.
Do not leave the data elements all bunched together when you do a drag ‘n drop. Make sure to include the usual windows menus that you’ve created in previous labs. Allow the user to gracefully exit the program through an “Exit” menu choice.
13_2) Based on the query you used in 13_1, write a C# program that will display CustomerID, CompanyName, ContactName, Address, City, Postal Code, Country, Phone, and Fax from the “Customers” table found in the CIS3260 database on the Hooch server. Only display this data from Customers who are designated as “Owner.” Do not show the Owner field on your form. You are NOT using a parameterized query…you are merely modifying the query that is created for you by the DB Wizard.
Use a grid with a good interface on the form. Again, make sure the grid’s column headings are using end-user English (See comments in the last problem about the CustomerID field). You may modify the grid to make it more visually pleasing to the user. Make sure to include the usual windows menus that you’ve created in previous labs. Allow the user to gracefully exit the program through an “Exit” menu choice.
13_3) Create a separate project based on what you did in 13_1. Again, show the Customers table information (same fields as in 13_1) in labels and texboxes. However, customers place orders. Link the customer information to the order they placed.
Show each customer’s corresponding order(s) in a grid below the customer information. The grid should only contain the fields; OrderID, OrderDate, RequiredDate, ShippingDate, ShipVia, and Freight. Make sure to change the column headings for proper user interface (E.g., ShipCountry is poor interface for an end-user).
13_4) Create another project with the same Customers parent table shown in labels and textboxes.
This time, use one grid with the linked Orders table showing the fields; OrderID, ShipName, ShipAddress, ShipCity, ShipPostalCode, and ShipCountry.
In a second grid, show the all the fields OrderDetails table. This grid should be linked to the Orders table so that when you change a customer, you’ll see the orders they’ve placed (each order placed shows all the shipping information for that customer) and the order details for each order. In other words, if a user clicks on an order in the shipping information grid, the details for that particular order will show up in a second grid placed below the first.
Again, use good interface design.
13_5) Create another project based upon 13_4 above. This time, allow the user to choose a country and see all the customers from that country. The customers table will be smaller based upon the name of the country entered by the user. For each customer from a country, the user should still get the same results they received in 13_4 with all the orders and order details for customers from within that country.
Make sure that when no country is entered in the query text box in the fillbyxxxToolStrip (where xxx is the name you’ve given the fillbymethod), the full customer table should be restored. Also, make sure you change the fillbyxxxToolStrip.text property to something more meaningful. By default, it will be the name of your parameter. Similarly, change the fillbyxxxToolStripButton.text text property to be more user-friendly. A label called “FillByCountry” is not user-friendly.
For 5 points extra credit, create a second dataset that will only populate a combobox bound only to the Customers ContactTitle field. By using the default method of the combobox (SelectedIndexChanged), create a second FillBy query that will let the user pick a ContactTitle from the combobox, such as “Sales Agent, “ and by doing so, only show the customers who hold that title. A full five points if the combobox does not repeat values (so Sales Agent or Owner only show once). Additionally, these titles should be in alphabetical order. You can still get 3 extra credit points if you can’t figure out how to do this and show many extraneous values in the combobox.
Introduction to Programming Using C#
Dr. David McDonald
Web site: http://www3.cis.gsu.edu/dmcdonald
Office: 35 Broad Street Room 934
Hours: W 2:00PM - 3:00PM, or by appointment
Sanchitha Suresh, MS, CIS
Hours: Th. 1-3 PPM
Or by Appointment)
CIS 2010; CSP 1.
Bradley, J.C. and Millspaugh, A.C., "Programming in Visual C# 2008," First Edition, McGraw-Hill 2008, ISBN 978-0-07-351721-6
Free! Visual Studio.NET 2008 available through the CIS Department's involvement with Microsoft's Developer Network's Academic Alliance program. All of the Microsoft's developer's catalog is available free to any student who is taking a CIS Department class. This includes products such as MS Windows XP, Vista, SQL Server, MS Project 2008, Visio 2008, etc., etc., etc. This is a GREAT deal. Make use of it as much or as little as you like. These are the full-blown products, not cut-down student versions. Use of the Microsoft corporate jet is NOT included as part of this deal! For this course, if you elect not to use the GSU labs, you MUST use Visual Studio 2008 Professional Edition. Versions that are bundled with the text WILL NOT WORK IN THIS CLASS. Also, if you want the help system, download the MSDN libraries. Go to: http://msdn.e-academy.com/elms/Storefront/Home.aspx?campus=gsu_cis.
Introduction to Programming in C#. Prerequisite: This course provides an introduction to programming using the C# language. Emphasis is placed upon the development of correct, efficient programs that are easy to maintain. Topics include problem analysis, program design, documentation, testing and debugging. Basic features of the C# programming language are covered.
Detailed Course Description
Topics covered in this course are divided into five groups: (1) Interface design, including multimedia (graphics, sound, and video), (2) object oriented concepts, including object variables, classes, class creation, collections, encapsulation, polymorphism, inheritance, aggregation, containment, properties, and methods, (3) using ADO controls for transaction processing, as well as random access files, (4) (5) Internet programming, including HTML, DHTML, and the Winsock control.
Detailed Course Objectives
At the end of the semester, the student will:
- Be able to demonstrate a knowledge of interface design principles and be able to apply them in a visual programming environment.
- Have a working knowledge of object oriented concepts and how to implement them in a visual programming environment.
- Be able to apply database linkages, whether the application is run locally, networked, or on the Internet.
- Create an Internet application in a visual programming environment.
- Access and utilize middleware components for the operating system, the network, and the database management system.
For the course project, students, working in groups of three or four, will prepare fully functioning programs, of significant complexity, in Visual C# that address a typical business need. The complete specifications for the projects will be covered in a separate handout.
Make-up exams are NOT given. Students missing an exam will receive a zero on that assignment. Exams may be taken early if the instructor is given a legitimatereason (religious holiday, scheduled surgeries, pregnancy, etc.).
Each student is expected to complete his or her lab assignments in the allocated time. Once the class starts on the due date, the assignment will not be accepted!
All work must be your own. Duplicate lab assignments will be given a grade of "zero". Both the person copying the assignment and the person supplying the copy will be penalized equally! LET ME REPEAT THIS...working with other students on a lab assignment will result in a charge of academic dishonesty and a zero given to all participants!
Conduct of Course: Lecture/Discussions, Demos, and Labs:
Class sessions will be divided between: (1) lecture/discussion of certain software concepts and features, (2) instructor demonstrations of these same software concepts and features, and (3) student laboratory sessions working with these same software concepts and features.
The purpose of this pedagogical approach is to introduce and reinforce ideas and skill sets so that students can master these on their own after class hours. To bring this knowledge to a highly proficient, professional level, students will have to spend time and effort outside of class working in the GSU computer labs or on their own micros.
To ensure that you have the basic knowledge that will allow you to function on your own after class, be sure to ask the instructor questions during class, either during the lecture/discussion, demo, or lab.
Lab assignments are due at the start of lecture on the day they are due. Once lecture has begun, the lab assignment is considered late and will not be accepted. No lab assignment will be accepted once the lecture has begun. "Zipped" emailed attachments are acceptable.
Plus/minus Final Grade Policy
|Numeric Range||Letter Grade|
|Less than 59||F+|
A 'W' grade will be assigned if a student withdraws before the middle of the semester (7/1/2009) while maintaining a passing grade. A 'WF' will be assigned if a student withdraws before the middle of the semester while doing failing work OR after the middle of the semester.
All students are required to attend all classes. If one or more class is missed, it is the student's responsibility to determine the specific material covered during their absence and make the necessary arrangements for making up what is missed. Class discussion is strongly encouraged. In fact, participation points are not "gimme' points. You'll have to earn them by being prepared for each class session.
General Class Policies
- Prerequisites are strictly enforced. Students failing to complete a prerequisites with a grade of C or higher will be administratively withdrawn from the course in which they are in violation with a loss of tuition fees. There are no exceptions.
- Students are expected to attend all classes and group meetings, except when precluded by emergencies, religious holidays or bona fide extenuating circumstances.
- Students who, for non-academic reasons beyond their control, are unable to meet the full requirements of the course should notify the instructor. Incompletes may be given if a student has ONE AND ONLY ONE outstanding assignment.
- A W grade will be assigned if a student withdraws before mid-semester while maintaining a passing grade. Withdrawals after the mid-semester date will result in a grade of WF. Refer to GSU catalog or Registrars office for details.
- Spirited class participation is encouraged and informed discussion in class is expected. This requires completing readings and assignments before class.
- Unless specifically stated by the instructor, all exams and lab assignments are to be completed by the student alone.
- Within group collaboration is allowed on project work. Collaboration between project groups will be considered cheating unless specifically allowed by an instructor.
- Copy work from the Internet without a proper reference will be considered plagiarism and subject to disciplinary action as delineated in the Student Handbook.
- Any non-authorized collaboration will be considered cheating and the student(s) involved will have an Academic Dishonesty charge completed by the instructor and placed on file in the Deans office and the CIS Department. All instructors regardless of the type of assignment will apply this Academic Dishonesty policy equally to all students. See excerpt from the Student Handbook below:
(Abstracted from GSUs Student Handbook Student Code of Conduct Policy on Academic Honesty and Procedures for Resolving Matters of Academic Honesty - http://www2.gsu.edu/~wwwdos/wordFilesEtc/2008_0418_StudentCodecweb.pdf)
As members of the academic community, students are expected to recognize and uphold
standards of intellectual and academic integrity. The University assumes as a basic and minimum standard of conduct in academic matters that students be honest and that they submit for credit only the products of their own efforts. Both the ideals of scholarship and the need for fairness require that all dishonest work be rejected as a basis for academic credit. They also require that students refrain from any and all forms of dishonorable or unethical conduct related to their academic work.
Students are expected to discuss with faculty the expectations regarding course assignments and standards of conduct. Here are some examples and definitions that clarify the standards by which academic honesty and academically honorable conduct are judged at GSU.
Plagiarism. Plagiarism is presenting another persons work as ones own. Plagiarism includes any paraphrasing or summarizing of the works of another person without acknowledgment, including the submitting of another students work as ones own. Plagiarism frequently involves a failure to acknowledge in the text, notes, or footnotes the quotation of the paragraphs, sentences, or even a few phrases written or spoken by someone else. The submission of research or completed papers or projects by someone else is plagiarism, as is the unacknowledged use of research sources gathered by someone else when that use is specifically forbidden by the faculty member. Failure to indicate the extent and nature of ones reliance on other sources is also a form of plagiarism. Failure to indicate the extent and nature of ones reliance on other sources is also a form of plagiarism. Any work, in whole or part, taken from the internet or other computer based resource without properly referencing the source (for example, the URL) is considered plagiarism. A complete reference is required in order that all parties may locate and view the original source. Finally, there may be forms of plagiarism that are unique to an individual discipline or course, examples of which should be provided in advance by the faculty member. The student is responsible for understanding the legitimate use of sources, the appropriate ways of acknowledging academic, scholarly or creative indebtedness, and the consequences of violating this responsibility.
Cheating on Examinations. Cheating on examinations involves giving or receiving unauthorized help before, during, or after an examination. Examples of unauthorized help include the use of notes, texts, or crib sheets during an examination (unless specifically approved by the faculty member), or sharing information with another student during an examination (unless specifically approved by the faculty member). Other examples include intentionally allowing another student to view ones own examination and collaboration before or after an examination if such collaboration is specifically
forbidden by the faculty member.
Unauthorized Collaboration. Submission for academic credit of a work product, or a part thereof, represented as its being ones own effort, which has been developed in substantial collaboration with assistance from another person or source, or computer honesty. It is also a violation of academic honesty knowingly to provide such assistance. Collaborative work specifically authorized by a faculty member is allowed.