Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask DBMS Expert


Home >> DBMS

Lab Assignments

Objectives

In this lab assignment, students will learn:

- How to define LINQ statement
- How to use LINQ to query data from object array

Goals

In this lab assignment, students will demonstrate the abilities to:

- Define LINQ statement
- Use LINQ to query data from object array

1. Create a console application "LINQGradeBook"

2. Add the following class definition:

Public Class GradeBook
Private nameValue As String
Private scoreValue As Integer
Public Sub New(ByVal n As String, ByVal s As Integer)
nameValue = n
scoreValue = s
End Sub
Public Property Name() As String
Get
Return nameValue
End Get
Set(ByVal value As String)
nameValue = value
End Set
End Property

Public Property Score() As Integer
Get
Return scoreValue
End Get
Set(ByVal value As Integer)
scoreValue = value
End Set
End Property
Public Sub displayGradeBook()
Console.WriteLine("Name: " & Name & vbTab & "Score: " & Score)
End Sub

End Class

3. Rename the file "Module1.vb" to "LINQGradeBookTester.vb"

4. Complete the missing code following the comments. You are required to create two LINQ statements which will select specific gradeBook object from a GradeBook objects array.

Option Strict On
Module LINQGradeBookTester

Sub Main()
Dim g1 As New GradeBook("AAA", 70)
Dim g2 As New GradeBook("BBB", 50)
Dim g3 As New GradeBook("CCC", 100)
Dim g4 As New GradeBook("DDD", 80)
'add g1, g2, g3 and g4 in a array and display all student scores
Dim gradeBooks As GradeBook() = {g1, g2, g3, g4}
display(gradeBooks, "Scores for all students: ")

'create a LINQ which get all scores in ascending order and display them.

'create a LINQ which get all students who passed the exam

'display number of passed students, their names and scores

End Sub

'display gradeBook's information
Private Sub display(ByVal gradeBooks As IEnumerable, ByVal header As String)
Console.WriteLine(header)
For Each g As GradeBook In gradeBooks
g.displayGradeBook()
Next
Console.WriteLine()
End Sub

End Module

Here is output:

547_Module Output.jpg

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M92288620

Have any Question?


Related Questions in DBMS

Answer the following question explain the difference

Answer the following Question : Explain the difference between a database management system (DBMS) and a database. Are Microsoft Access, SQL Server, and Oracle examples of databases or database management systems (DBMS)?

Sql injection on a searchthe way search performs its task

SQL injection on a search The way Search performs its task is by executing the following query (in a php script):          $var=stripslashes($_POST['search']);          $query = "SELECT username from lab1_login where use ...

Question suppose we have two kinds of doctors hospital

Question : Suppose we have two kinds of doctors: hospital doctors and family physicians. In addition to the doctor's id number, name, specialty, and years of experience, we want to record the hospital name for the hospit ...

Question 1 what isdata-manipulation language dml there are

Question: 1. What isData-Manipulation Language (DML)? There are four types of access in DML, explain each one. 2. Assume we have a Library Database consists of the following relations: author(author_id, first_name, last_ ...

Query 1 the bookstore has decided to keep track of the

Query 1: The bookstore has decided to keep track of the vendors' information. In order to do this, one new table will be added to the database. The schema for this table, as related to the existing tables, is the followi ...

Football association of zambia faz super leaguethe faz has

Football Association of Zambia (FAZ) Super League The FAZ has recently decided to reorganise their operations to support both existing and possibly expanded league operations in Zambia and part of preparation for the 201 ...

Assignmenta restaurant is designing a database to keep

Assignment A restaurant is designing a database to keep track of customer services. A customer is defined as a customer ID, name, address and a telephone number. Customers are served by employees. Each employee is define ...

Case study problem 1 the case study company has experienced

Case Study: Problem 1 The case study company has experienced rapid growth in both the size of its client base and also in the services provided to clients. Unfortunately, the growth in data management policies, procedure ...

Database design amp development assignment -assignment

Database Design & Development Assignment - Assignment title - Design and Implement a Relational Database for a local Print and Ink Refill Business. Learning Outcome - Use an appropriate design tool to design a relational ...

Real time analytics - data analytics assignment -this is a

Real Time Analytics - Data Analytics Assignment - This is a business analytics project aimed at generating innovative analytics solutions for a Global Food Consulting firm working in the area of Animal agriculture and fa ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As