Ask a question to Desklib · AI bot


Working with Sessions and Collections in .NET Web Forms Applications

Added on -2019-09-20

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.
| 4 pages
| 860 words

Trusted by 2+ million users,
1000+ happy students everyday

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()+
"calories"; 18 } 19 else { 20 s = "Hands off! Not edible"; 21 } 22 return s; 23 } 24 }

Found this document preview useful?

You are reading a preview
Upload your documents to download
Become a Desklib member to get accesss

Students who viewed this