visual_basic_assig.zip

VB test/Mileage.txt

Prius 2.1
Camry 4.1
Sebring 4.2
Mustang 5.3
Accord 4.1
Camry 3.8
Camry 3.9
Mustang 5.2
Accord 4.3
Prius 2.3
Camry 4.2
Accord 4.4

VB test/project 11 page 366.rtf

11. Fuel Economy, A fuel economy study was carried out for five models of cars. Each car was driven 100 miles, and then the model of the car and the number of gallons sued were placed in a line of the file Mileage.txt Table 7.22 shows the data for the entries of the file. Write a program to mileage. See Fig 7.81 The program should utilize an array of structures with upper bound 4, where each structure has three members. The first member should record the name of each model of car. The second member should record the number of test vehicles for each model. The third member should record the total number of gallons used by that model. [ Hint: two function procedures that are helpful have the headers Function NumCars(make As string) As Integer and Function NumGals(make As String) As Double. NumCars calculates the number of cars of the specified model in the table, and NumGals calculates the number of gallons used by the model. Both Function procedures are easily coded with LINQ queries.]

Table 7.22 Gallons of gasoline used in 100 miles of driving

Model Gal

Model Gal

Model Gal

Prius 2.1

Camry 4.1

Sebring 4.2

Mustang 5.3

Accord 4.1

Camry 3.8

Camry 3.9

Mustang 5.2

Accord 4.3

Prius 2.3

Camry 4.2

Accord 4.4

Fuel Economy

Model

MPG

Prius

45.45

Camry

25.00

Sebring

23.81

Accord

23.44

Mustang

19.05

Compute MPG

FIGURE 7.81 Outcome of Programming Project 11.

VB test/VB Test 3 direction.rtf

Project 11 on page 366. 

I have saved a file that uses 2 functions and 2 queries as an example on canvas.  I will not answer questions on any part of the code of the examine until after I lecture Thursday. 

25 points Pseudo Code

65 points functionality of project and documentation of subs and functions as described in the project (1-2 sentences).

10 points creating code that makes the cars over 30 or under 20 MPG stand out in some other way.  (I will not help with this part at all.  Do some research Google and forums can be your friends at times.)

I will give 5 bonus points if it is turned in by Friday at 11:59 pm.  

Assig 3 page 366/Assig3.sln

Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Exam 3", "Exam 3\Exam 3.vbproj", "{0FC1619D-4532-426D-88FD-BB0FE44E86D1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {0FC1619D-4532-426D-88FD-BB0FE44E86D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0FC1619D-4532-426D-88FD-BB0FE44E86D1}.Debug|Any CPU.Build.0 = Debug|Any CPU {0FC1619D-4532-426D-88FD-BB0FE44E86D1}.Release|Any CPU.ActiveCfg = Release|Any CPU {0FC1619D-4532-426D-88FD-BB0FE44E86D1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal

Assig 3 page 366/Assig3/App.config

Assig 3 page 366/Assig3/bin/Debug/Exam 3.exe

Assig 3 page 366/Assig3/bin/Debug/Exam 3.exe.config

Assig 3 page 366/Assig3/bin/Debug/Exam 3.pdb

Assig 3 page 366/Assig3/bin/Debug/Exam 3.vshost.exe

Assig 3 page 366/Assig3/bin/Debug/Exam 3.vshost.exe.config

Assig 3 page 366/Assig3/bin/Debug/Exam 3.vshost.exe.manifest

Assig 3 page 366/Assig3/bin/Debug/Exam 3.xml

Exam3 Returns the cached ResourceManager instance used by this class. Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class. A strongly-typed resource class, for looking up localized strings, etc.

Assig 3 page 366/Assig3/bin/Debug/Mileage.txt

Prius 2.1
Camry 4.1
Sebring 4.2
Mustang 5.3
Accord 4.1
Camry 3.8
Camry 3.9
Mustang 5.2
Accord 4.3
Prius 2.3
Camry 4.2
Accord 4.4

Assig 3 page 366/Assig3/Exam 3.vbproj

Debug AnyCPU {0FC1619D-4532-426D-88FD-BB0FE44E86D1} WinExe Exam_3.My.MyApplication Exam_3 Exam 3 512 WindowsForms v4.5.1 AnyCPU true full true true bin\Debug\ Exam 3.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 AnyCPU pdbonly false true true bin\Release\ Exam 3.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 On Binary Off On Form Form1.vb Form True Application.myapp True True Resources.resx True Settings.settings True Form1.vb VbMyResourcesResXFileCodeGenerator Resources.Designer.vb My.Resources Designer MyApplicationCodeGenerator Application.Designer.vb SettingsSingleFileGenerator My Settings.Designer.vb

Assig 3 page 366/Assig3/Exam 3.vbproj.user

Assig 3 page 366/Assig3/Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class frmFuelEconomy Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.btnComputeMPG = New System.Windows.Forms.Button() Me.DataGridView1 = New System.Windows.Forms.DataGridView() CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'btnComputeMPG ' Me.btnComputeMPG.Location = New System.Drawing.Point(78, 35) Me.btnComputeMPG.Name = "btnComputeMPG" Me.btnComputeMPG.Size = New System.Drawing.Size(108, 34) Me.btnComputeMPG.TabIndex = 0 Me.btnComputeMPG.Text = "Compute MPG" Me.btnComputeMPG.UseVisualStyleBackColor = True ' 'DataGridView1 ' Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.DataGridView1.Location = New System.Drawing.Point(22, 89) Me.DataGridView1.Name = "DataGridView1" Me.DataGridView1.Size = New System.Drawing.Size(240, 150) Me.DataGridView1.TabIndex = 1 ' 'frmFuelEconomy ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(284, 262) Me.Controls.Add(Me.DataGridView1) Me.Controls.Add(Me.btnComputeMPG) Me.Name = "frmFuelEconomy" Me.Text = "Fuel Economy" CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub Friend WithEvents btnComputeMPG As System.Windows.Forms.Button Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView End Class

Assig 3 page 366/Assig3/Form1.resx

text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Assig 3 page 366/Assig3/Form1.vb

Public Class frmFuelEconomy Structure Cars Dim vehicleNumber As Integer Dim make As String Dim Gallons As Double End Structure Dim car(4) As Cars Dim model() As String = IO.File.ReadAllLines("mileage.txt") Function Numcars(make As String) As Integer Dim query = From line In model Let vehicle = CStr(line.Split(","c)(0)) Where vehicle = make Select vehicle Return query.Count End Function Function NumGals(make As String) As Double Dim query = From line In model Let mpg = CDbl(line.Split(","c)(1)) Let vehicle = line.Split(",")(0) Where vehicle = make Select mpg Return query.Count End Function Private Sub btnComputeMPG_Click(sender As Object, e As EventArgs) Handles btnComputeMPG.Click Dim query1 = From line In model Let vehicle = line.Split(","c)(0) Select vehicle Dim temp() = query1.ToArray End Sub End Class

Assig 3 page 366/Assig3/My Project/Application.Designer.vb

'------------------------------------------------------------------------------ ' <auto-generated> ' This code was generated by a tool. ' Runtime Version:4.0.30319.18444 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' </auto-generated> '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My 'NOTE: This file is auto-generated; do not modify it directly. To make changes, ' or if you encounter build errors in this file, go to the Project Designer ' (go to Project Properties or double-click the My Project node in ' Solution Explorer), and make changes on the Application tab. ' Partial Friend Class MyApplication <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ Public Sub New() MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) Me.IsSingleInstance = false Me.EnableVisualStyles = true Me.SaveMySettingsOnExit = true Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses End Sub <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ Protected Overrides Sub OnCreateMainForm() Me.MainForm = Global.Exam_3.frmFuelEconomy End Sub End Class End Namespace

Assig 3 page 366/Assig3/My Project/Application.myapp

<?xml version="1.0" encoding="utf-16"?> <MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <MySubMain>true</MySubMain> <MainForm>frmFuelEconomy</MainForm> <SingleInstance>false</SingleInstance> <ShutdownMode>0</ShutdownMode> <EnableVisualStyles>true</EnableVisualStyles> <AuthenticationMode>0</AuthenticationMode> <SaveMySettingsOnExit>true</SaveMySettingsOnExit> </MyApplicationData>

Assig 3 page 366/Assig3/My Project/AssemblyInfo.vb

Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes <Assembly: AssemblyTitle("Exam 3")> <Assembly: AssemblyDescription("")> <Assembly: AssemblyCompany("")> <Assembly: AssemblyProduct("Exam 3")> <Assembly: AssemblyCopyright("Copyright © 2014")> <Assembly: AssemblyTrademark("")> <Assembly: ComVisible(False)> 'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("5f73e579-5a15-45a1-be3b-b98995c9fd42")> ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: ' <Assembly: AssemblyVersion("1.0.*")> <Assembly: AssemblyVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>

Assig 3 page 366/Assig3/My Project/Resources.Designer.vb

'------------------------------------------------------------------------------ ' <auto-generated> ' This code was generated by a tool. ' Runtime Version:4.0.30319.18444 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' </auto-generated> '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My.Resources 'This class was auto-generated by the StronglyTypedResourceBuilder 'class via a tool like ResGen or Visual Studio. 'To add or remove a member, edit your .ResX file then rerun ResGen 'with the /str option, or rebuild your VS project. '''<summary> ''' A strongly-typed resource class, for looking up localized strings, etc. '''</summary> <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ Friend Module Resources Private resourceMan As Global.System.Resources.ResourceManager Private resourceCulture As Global.System.Globalization.CultureInfo '''<summary> ''' Returns the cached ResourceManager instance used by this class. '''</summary> <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Get If Object.ReferenceEquals(resourceMan, Nothing) Then Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Exam_3.Resources", GetType(Resources).Assembly) resourceMan = temp End If Return resourceMan End Get End Property '''<summary> ''' Overrides the current thread's CurrentUICulture property for all ''' resource lookups using this strongly typed resource class. '''</summary> <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Friend Property Culture() As Global.System.Globalization.CultureInfo Get Return resourceCulture End Get Set(ByVal value As Global.System.Globalization.CultureInfo) resourceCulture = value End Set End Property End Module End Namespace

Assig 3 page 366/Assig3/My Project/Resources.resx

text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Assig 3 page 366/Assig3/My Project/Settings.Designer.vb

'------------------------------------------------------------------------------ ' <auto-generated> ' This code was generated by a tool. ' Runtime Version:4.0.30319.18444 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' </auto-generated> '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) #Region "My.Settings Auto-Save Functionality" #If _MyType = "WindowsForms" Then Private Shared addedHandler As Boolean Private Shared addedHandlerLockObject As New Object <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) If My.Application.SaveMySettingsOnExit Then My.Settings.Save() End If End Sub #End If #End Region Public Shared ReadOnly Property [Default]() As MySettings Get #If _MyType = "WindowsForms" Then If Not addedHandler Then SyncLock addedHandlerLockObject If Not addedHandler Then AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings addedHandler = True End If End SyncLock End If #End If Return defaultInstance End Get End Property End Class End Namespace Namespace My <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _ Friend Module MySettingsProperty <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _ Friend ReadOnly Property Settings() As Global.Exam_3.My.MySettings Get Return Global.Exam_3.My.MySettings.Default End Get End Property End Module End Namespace

Assig 3 page 366/Assig3/My Project/Settings.settings

Assig 3 page 366/Assig3/obj/Debug/DesignTimeResolveAssemblyReferences.cache

Assig 3 page 366/Assig3/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

Assig 3 page 366/Assig3/obj/Debug/Exam 3.exe

Assig 3 page 366/Assig3/obj/Debug/Exam 3.pdb

Assig 3 page 366/Assig3/obj/Debug/Exam 3.vbproj.FileListAbsolute.txt

C:\Users\hin0002\AppData\Local\Temporary Projects\Exam 3\bin\Debug\Exam 3.exe.config C:\Users\hin0002\AppData\Local\Temporary Projects\Exam 3\obj\Debug\Exam_3.frmFuelEconomy.resources C:\Users\hin0002\AppData\Local\Temporary Projects\Exam 3\obj\Debug\Exam_3.Resources.resources C:\Users\hin0002\AppData\Local\Temporary Projects\Exam 3\obj\Debug\Exam 3.vbproj.GenerateResource.Cache C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\bin\Debug\Exam 3.exe.config C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\bin\Debug\Exam 3.exe C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\bin\Debug\Exam 3.pdb C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\bin\Debug\Exam 3.xml C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\obj\Debug\Exam_3.frmFuelEconomy.resources C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\obj\Debug\Exam_3.Resources.resources C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\obj\Debug\Exam 3.vbproj.GenerateResource.Cache C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\obj\Debug\Exam 3.exe C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\obj\Debug\Exam 3.xml C:\Users\hin0002\Documents\Visual Studio 2012\Projects\Exam 3\Exam 3\obj\Debug\Exam 3.pdb

Assig 3 page 366/Assig3/obj/Debug/Exam 3.vbproj.GenerateResource.Cache

Assig 3 page 366/Assig3/obj/Debug/Exam 3.xml

Exam3 Returns the cached ResourceManager instance used by this class. Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class. A strongly-typed resource class, for looking up localized strings, etc.

Assig 3 page 366/Assig3/obj/Debug/Exam_3.frmFuelEconomy.resources

Assig 3 page 366/Assig3/obj/Debug/Exam_3.Resources.resources

Assig 3 page 366/Assig3/obj/Debug/TempPE/My Project.Resources.Designer.vb.dll

Assig 3 page 366/Exam 3.v11.suo