Question

A fitness tracking app company has asked you to develop a windows application using a GUI...


A fitness tracking app company has asked you to develop a windows application using a GUI to determine the total amount of hours somebody has exercised during their lifetime, assuming on average a user has exercises 2.5 hours per week.

When the user uses the app, they will enter the following:

First Name:

Last Name:

Date of Birth (in mm/dd/yyyy):

Current Date (in mm/dd/yyyy)

This program should display the users name and the number of hours the user has exercised in their lifetime. The program should output in a label widget the users name and the number of hours exercised in their life time. The user can click a Clear button to Clear all entries and results and and Exit button to exit the application.

Note: This should be done in Windows Form App .VB

**I am mostly struggling to make the calculations with the dates as they are being entered into a text box.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

VB Application:

File: Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
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.Label1 = New System.Windows.Forms.Label()
Me.txtFirstName = New System.Windows.Forms.TextBox()
Me.txtLastName = New System.Windows.Forms.TextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.txtDOB = New System.Windows.Forms.TextBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.txtCurrDate = New System.Windows.Forms.TextBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.lblResult = New System.Windows.Forms.Label()
Me.btnCalculate = New System.Windows.Forms.Button()
Me.btnClear = New System.Windows.Forms.Button()
Me.btnExit = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(94, 30)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(60, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "First Name:"
'
'txtFirstName
'
Me.txtFirstName.Location = New System.Drawing.Point(190, 27)
Me.txtFirstName.Name = "txtFirstName"
Me.txtFirstName.Size = New System.Drawing.Size(100, 20)
Me.txtFirstName.TabIndex = 1
'
'txtLastName
'
Me.txtLastName.Location = New System.Drawing.Point(190, 66)
Me.txtLastName.Name = "txtLastName"
Me.txtLastName.Size = New System.Drawing.Size(100, 20)
Me.txtLastName.TabIndex = 3
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(94, 69)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(61, 13)
Me.Label2.TabIndex = 2
Me.Label2.Text = "Last Name:"
'
'txtDOB
'
Me.txtDOB.Location = New System.Drawing.Point(190, 106)
Me.txtDOB.Name = "txtDOB"
Me.txtDOB.Size = New System.Drawing.Size(100, 20)
Me.txtDOB.TabIndex = 5
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(37, 109)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(147, 13)
Me.Label3.TabIndex = 4
Me.Label3.Text = "Date of Birth (in mm/dd/yyyy):"
'
'txtCurrDate
'
Me.txtCurrDate.Location = New System.Drawing.Point(190, 145)
Me.txtCurrDate.Name = "txtCurrDate"
Me.txtCurrDate.Size = New System.Drawing.Size(100, 20)
Me.txtCurrDate.TabIndex = 7
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(37, 148)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(148, 13)
Me.Label4.TabIndex = 6
Me.Label4.Text = "Current Date (in mm/dd/yyyy):"
'
'lblResult
'
Me.lblResult.AutoSize = True
Me.lblResult.Font = New System.Drawing.Font("Lucida Sans Unicode", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblResult.Location = New System.Drawing.Point(37, 257)
Me.lblResult.Name = "lblResult"
Me.lblResult.Size = New System.Drawing.Size(0, 16)
Me.lblResult.TabIndex = 8
'
'btnCalculate
'
Me.btnCalculate.Location = New System.Drawing.Point(40, 198)
Me.btnCalculate.Name = "btnCalculate"
Me.btnCalculate.Size = New System.Drawing.Size(75, 23)
Me.btnCalculate.TabIndex = 9
Me.btnCalculate.Text = "Calculate"
Me.btnCalculate.UseVisualStyleBackColor = True
'
'btnClear
'
Me.btnClear.Location = New System.Drawing.Point(148, 198)
Me.btnClear.Name = "btnClear"
Me.btnClear.Size = New System.Drawing.Size(75, 23)
Me.btnClear.TabIndex = 10
Me.btnClear.Text = "Clear"
Me.btnClear.UseVisualStyleBackColor = True
'
'btnExit
'
Me.btnExit.Location = New System.Drawing.Point(255, 198)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(75, 23)
Me.btnExit.TabIndex = 11
Me.btnExit.Text = "Exit"
Me.btnExit.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(393, 324)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.btnClear)
Me.Controls.Add(Me.btnCalculate)
Me.Controls.Add(Me.lblResult)
Me.Controls.Add(Me.txtCurrDate)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.txtDOB)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.txtLastName)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.txtFirstName)
Me.Controls.Add(Me.Label1)
Me.Name = "Form1"
Me.Text = "Exercise"
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtFirstName As System.Windows.Forms.TextBox
Friend WithEvents txtLastName As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtDOB As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents txtCurrDate As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents lblResult As System.Windows.Forms.Label
Friend WithEvents btnCalculate As System.Windows.Forms.Button
Friend WithEvents btnClear As System.Windows.Forms.Button
Friend WithEvents btnExit As System.Windows.Forms.Button

End Class

File: Form1.vb

Public Class Form1

' Calculate button click event handler
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

' Fetching name
Dim fName, lName As String
fName = txtFirstName.Text
lName = txtLastName.Text

' Fetching Date of Birth
Dim DOB As String
DOB = txtDOB.Text

' Extracting day, month, year
Dim dd, mm, yyyy As Integer
dd = DOB.Split("/")(1)
mm = DOB.Split("/")(0)
yyyy = DOB.Split("/")(2)

' Creating a date
Dim DOBDate As New Date(yyyy, mm, dd)

' Fetching Current date
Dim curr As String
curr = txtCurrDate.Text

' Extracting day, month, year
dd = curr.Split("/")(1)
mm = curr.Split("/")(0)
yyyy = curr.Split("/")(2)

' Creating a date
Dim currDate As New Date(yyyy, mm, dd)

' Extracting number of days
Dim days As Double = (currDate - DOBDate).TotalDays()

' Calculating Hours Exercised
Dim hrsExercised As Double
' 2.5 Hours per week
hrsExercised = (days / 7.0) * 2.5

' Results
lblResult.Text = "User Name: " & fName & " " & lName & vbNewLine & "Number of hours exercised: " & hrsExercised.ToString("##.#")

End Sub

' Clear button click event handler
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
' Clearing all entries
txtFirstName.Clear()
txtLastName.Clear()
txtDOB.Clear()
txtCurrDate.Clear()
lblResult.Text = ""
End Sub

' Exit button click event handler
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Application.Exit()
End Sub
End Class
______________________________________________________________________________________________________

Sample Run:

Add a comment
Know the answer?
Add Answer to:
A fitness tracking app company has asked you to develop a windows application using a GUI...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a GUI program (a Windows Forms Application) called GooseEggCalculator that lets a user enter the...

    Create a GUI program (a Windows Forms Application) called GooseEggCalculator that lets a user enter the number of eggs produced by each of four geese. Your program should provide textboxes with labels for the user to enter the values. When the user clicks a Calculate button, your app should sum the textboxes, then display the total number of eggs, as well as the number of eggs in dozens and remaining eggs, as shown on the example. Feel free to make...

  • Write a (Windows) two-class application that creates a customer code to be placed on a mailing...

    Write a (Windows) two-class application that creates a customer code to be placed on a mailing label for a magazine. Allow the user to input their full name with the first name entered first. Prompt them to separate their first and last name with space. Ask for their birthdate in the format of mm/dd/ yyyy. Ask for the month (number) they purchased a subscription and ask for their zip code. Your mailing label should contain the last name, followed by...

  • Develop a Windows Forms application that will allow a user to select between the 5 different...

    Develop a Windows Forms application that will allow a user to select between the 5 different soring algorithms. • The application’s GUI should include / perform the following: o A textbox to enter a string value o A button to submit the string value o A listbox to store all of the submitted string values. The entries in this list will always be unsorted, i.e. it should list the entries in the sequence in which they have been captured. o...

  • INSTRUCTIONS #6. Your science teacher has asked you to create an application that displays how much...

    INSTRUCTIONS #6. Your science teacher has asked you to create an application that displays how much a person would weigh on the following planets: Venus, Mars, and Jupiter. The application's interface should allow the user to enter the person's weight on Earth. Perform the steps involved in creating an OO application. (See the Note at the beginning of the Exercises section.) Include a button for clearing the screen. . Create an application, using the following names for the solution and...

  • How do you do this using visual studio on a Mac? You are tasked with creating...

    How do you do this using visual studio on a Mac? You are tasked with creating an application with five PictureBox controls. In the Poker Large folder, you will find JPEG image files for a complete deck of poker cards. Feel free to choose any card image that you like or be creative with this application. Each PictureBox should display a different card from the set of images. When the user clicks any of the PictureBox controls, the name of...

  • Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by...

    Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by implementing Person and Student classes. Once you are sure you can serialize and deserialize and ArrayList of Students to and from a file, move on to building the GUI application. Person: The Person class should implement serializable interface. It contains the following: Person's first name (String) Person's last name (String) Person's id number Person's date of birth (Date) public String toString(): This method method...

  • You are to write a basic fitness application, in C++, that allows the user of the...

    You are to write a basic fitness application, in C++, that allows the user of the application to manually edit “diet” and “exercise” plans. For this application you will need to create three classes: DietPlan, ExercisePlan, and FitnessAppWrapper. Diet Plan Attributes: The class DietPlan is used to represent a daily diet plan. Your class must include three data members to represent your goal calories (an integer), plan name (a std::string), and date for which the plan is intended (a std::string)....

  • please write C++ code to finish R0,R1,R2 Introduction In this assignment, you are going to develop...

    please write C++ code to finish R0,R1,R2 Introduction In this assignment, you are going to develop a "Schedule Book System that runs in the command line environment. The system stores the schedule of events input by user and allows users to add view or delete events. You can assume that the system can at most store 100 events Each group is required to write a Win32 Console Application program called ScheduleBook.cpp The requirements are listed below. RO When the program...

  • The local driver’s license office has asked you to write a program that grades the written...

    The local driver’s license office has asked you to write a program that grades the written portion of the driver’s license Rules and Signals Test. The driver license test has 25 multiple choice questions. The set of answer keys is: 1.A 6.B 11.C 16.B 2 21.B 2.C 7.C 12.A 17.A 22.C 3.B 8.D 13.B 18.C 23.A 4.B 9.A 14.C 19.A 24.D 5.D 10.B 15.A 20.D 25.B First, the application displays messages to ask for the information of current candidate about...

  • the first question java code eclipse app the second question is java fx gui caculator please...

    the first question java code eclipse app the second question is java fx gui caculator please fast 1. Create project called "YourFirstName_QUID'. Eg. Aliomar_202002345 2. Create two package Q1 and Q2. 3. Add your name and studentID as comments on the top of each Java source file you submit. Question 1. Bookings APP [80 Points-six parts] Implement the following hotel booking system. Use the following class diagram to understand the structure of the system's classes, their attributes operations (or methods),...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT