0% found this document useful (0 votes)
169 views

Lab 01

This document provides instructions for completing Lab 2, which involves creating a console application and Windows forms application in C# using object-oriented programming concepts. For the console app, students must create a class hierarchy for various shapes and allow a user to create shape objects and view their properties. For the Windows forms app, students must create a hair salon pricing calculator that validates user input and displays the total price based on selections. The document outlines grading criteria, program requirements, and reference materials for completing the tasks.

Uploaded by

Mariam Mobeen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
169 views

Lab 01

This document provides instructions for completing Lab 2, which involves creating a console application and Windows forms application in C# using object-oriented programming concepts. For the console app, students must create a class hierarchy for various shapes and allow a user to create shape objects and view their properties. For the Windows forms app, students must create a hair salon pricing calculator that validates user input and displays the total price based on selections. The document outlines grading criteria, program requirements, and reference materials for completing the tasks.

Uploaded by

Mariam Mobeen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Programming in .

NET – COMP 10204


Lab 2
To do this lab, you will need to use C# in Visual Studio Professional 2019. You can download via Azure
Dev Tools for Teaching. Check myCanvas for details on how to access this.

Grading Details
• This lab constitutes 6% of your final grade.
• Please examine the marking rubric to see the marks breakdown.
• This program needs to have appropriate comments, including XML comments for every class
and every method (see Reference Material).
• This program also needs to have an appropriate comment block that contains:
o Your name and student number
o The file date
o The program's purpose
o Your Statement of Authorship
• Bundle your project into one Zip file, save it as LastnameFirstinitial.zip, and upload it to
myCanvas
• Follow C# naming conventions (see reference material).
• Programs that are late or do not include a Statement of Authorship will be penalized 10% per
day (includes each day of a weekend).

Program Requirements
Project Name: Lab2A
Write a Console App (.NET Framework) that:

• Makes use of an abstract class called Shape which represents one single shape
• Creates an object hierarchy to include additional classes for:
o Rectangle
o Square
o Box
o Cube
o Ellipse
o Circle
o Cylinder
o Sphere
o Triangle
o Tetrahedron
• Prompts the user via a menu to create an instance of one of your shapes
• Uses polymorphism to store shapes into a list
• Continues to prompt until the user selects the exit option
• Displays a neat, orderly table of all instantiated shapes, their dimensions, areas and, in the case
of three-dimensional shapes, their volumes

1
• The main class (Lab2) should have the following features:
o A list to store shapes of any kind
o Error checking for user input
o The Main( ) method should be highly modularized

You are to use this unmodified code for the abstract Shape class (save and rename as Shape.cs)

Each of your derived classes must implement in some way:

• A SetData( ) method that prompts the user to enter each dimension for the current shape
• A CalculateArea( ) method that calculates the area of the shape, or for a three-dimensional
shape, the surface area
• A CalculateVolume( ) method that calculates the volume of three-dimensional shapes only
• An overidden ToString( ) method that you can use to print each line of the table
• It is recommended that you code each of your classes in a different .cs class file (ie, Square.cs,
Circle.cs, etc.)
• You may find Wikipedia useful for determing the formulae needed for area and volume
calculations

You may download the sample program for a demonstration of program behaviour

The challenging part of this program is in creating a proper hierarchy:

• It is recommended that you work on one class at a time


• You must create an actual hierarchy that does not simply involve having all classes descend from
the base class

Project Name: Lab2B


Write a Windows Form App (.NET Framework) that:

• Makes use of a GUI interface (shown to the right) that determines pricing for a hair salon
• The user must:
1. Select one Hairdresser, each of which has a different base rate:
• Jane - $30
• Pat - $45
• Ron - $40
• Sue - $50
• Laurie - $55
2. Select one or more Services, each of which has a different rate:
• Cut - $30
• Colour - $40

2
• Highlights - $50
• Extension - $200
3. Select one Client Type, which determines
what that client's discount rate will be:
• Standard Adult - 0%
• Child - 10%
• Student - 5%
• Senior - 15%
4. Enter the Number of Client Visits, which may
provide an additional discount:
• 1 to 3 visits - 0%
• 4 to 8 visits - 5%
• 9 to 13 visits - 10%
• 14+ visits - 15%
5. The Number of Client Visits must be validated
as a positive integer value
6. The Calculate button will determine and
display the Total Price
7. The Calculate button must ensure that the user selects at least one Service and provides a
positive integer value for Number of Visits, otherwise set the focus to the control in
question
8. The Clear button will clear all controls, select the first radio button in each groupbox, and
set focus to the first radio button in Hairdresser
• You may download the sample program for a demonstration of program behaviour

3
Marking Rubric
Lab 2A

Documentation:
/5
Comments, Naming Conventions

Object Hierarchy:
/1
Proper Hierarchy Layout
Rectangle, Square:
Constructor, SetData, ToString, Area /2

Ellipse, Circle:
/3
Constructor, SetData, ToString, Area
Box, Cube:
Constructor, SetData, ToString, Area, Volume /3

Cylinder, Sphere:
/2
Constructor, SetData, ToString, Area, Volume

Triangle, Tetrahedron:
/2
Constructor, SetData, ToString, Area, Volume

Menu:
/1
All Options, Re-Prompts

Output:
/2
Neat, Complete, Properly Aligned

Lab 2B
Documentation: /5
Comments, Naming Conventions

Interface: /5
Correctly Implemented

Validation: /3
Number of Visits > 0

Calculate Button: /3
Correct and Properly Formatted Output

Clear Button: /2
Resets Controls

Exit Button: /2
Works

Total /40

4
Reference Material
https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/

https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/inheritance

You might also like