Ask a question from expert

Ask now

Working with Sessions and Collections in .NET Web Forms Applications

4 Pages860 Words356 Views
   

Added on  2019-09-20

About This Document

This article covers the implementation of sessions and collections in .NET Web Forms applications through a basket of fruit application and a people application. It also includes an advanced section on improving the basket of fruit application by creating a new class called Beverage. The article provides detailed explanations of the code used in the applications and offers hints to achieve the desired functionality.

Working with Sessions and Collections in .NET Web Forms Applications

   Added on 2019-09-20

BookmarkShareRelated Documents
LAB 6 Working with Sessions and CollectionsPlease upload Part B, C and D applications from this lab in your weekly uploadas part of your logbook. Delete the “packages” file from your solution folderbefore compressing and uploading the applications.Important note: The .NET Web Forms applications are big in size and you will run out of memory space on your drives if you create many projects of this type. Please zip up your applications and keep them as compressed files in your folders (delete the unzipped ones).Part A – playing with codeThe following tasks are compulsory before you attempt part B:1.Build a similar application as the one presented in the lecture notes, slides16-23. If you get stuck the solution is available on your course (“Using Sessions” application).2.Open all the other applications available on the course page for this week and comment the C# codePart B - Basket of Fruit applicationStudy the following code: 01 publicclassFruit { 02 privatestring fName; 03 privateint grams, calsPerGram; 04 privatebool edible; 05 public Fruit(string n,int g, int c, bool e) { 06 grams = g; 07 calsPerGram = c; 08 edible = e; 09 fName = n; 10 } 11 publicint totalCalories() { 12 return grams * calsPerGram; 13 } 14 publicstring getFruitInfo() { 15 string s; 16 if (edible == true) { 17 s = fName + " is yummy and it has " + totalCalories()+
Working with Sessions and Collections in .NET Web Forms Applications_1
"calories"; 18 } 19 else { 20 s = "Hands off! Not edible"; 21 } 22 return s; 23 } 24 }
Working with Sessions and Collections in .NET Web Forms Applications_2

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Logbook. Element 1 Lab: Statements and Methods Part C-
|48
|4172
|365