VUSuperior Chat Room

Monday, 8 June 2015

CS411 Visual Programming Assignment No. 02 Solution And Discussion Spring 2015 Due Date: 12 June, 2015

Solution of Assignment No. 02
Semester: Spring 2015
Visual Programming-CS411

Total Marks: 20

Due Date: 12/June/2015
Instructions:                          
Please read the following instructions carefully before submitting assignment:
§  You will submit your assignment before or on due date on VU-LMS.
§  Assignment should be completed by your own efforts it should not be copied from internet, handouts or books.
§  Zip your application folder and upload your zipped file.
§  Assignment sent via Email will not be replied and accepted in any case.

Objectives:
To build the programming practices in C# environment.
For any query about the assignment, contact at cs411@vu.edu.pk
Assignment Questions
Create a WPF application with three text boxes, three labels and one button as designed below:

Users need to fill values in the text boxes and will click on button “How old I am?” to calculate his/her age.
You are further requested to implement the Age calculation method in the click event of the button.  After the required calculation a message box should be appeared with like the following message:
“Hello Asad! You are 25 years and 3 months old”
 
BEST OF LUCK


3 comments:

  1. using System.Diagnostics;
    using System;
    using System.Windows.Forms;
    using System.Collections;
    using System.Drawing;
    using Microsoft.VisualBasic;
    using System.Data;
    using System.Collections.Generic;



    namespace Calculate_Age
    {
    public partial class Form1
    {
    public Form1()
    {
    InitializeComponent();


    }


    public void Button1_Click(System.Object sender, System.EventArgs e)
    {
    int yr = (int) (DateAndTime.DateDiff(DateInterval.Year, DateTimePicker1.Value, DateTime.Now, (Microsoft.VisualBasic.FirstDayOfWeek) Microsoft.VisualBasic.FirstDayOfWeek.Sunday, (Microsoft.VisualBasic.FirstWeekOfYear) Microsoft.VisualBasic.FirstWeekOfYear.Jan1));
    int month = System.Convert.ToInt32(DateAndTime.DateDiff(DateInterval.Month, DateTimePicker1.Value, DateTime.Now, (Microsoft.VisualBasic.FirstDayOfWeek) Microsoft.VisualBasic.FirstDayOfWeek.Sunday, (Microsoft.VisualBasic.FirstWeekOfYear) Microsoft.VisualBasic.FirstWeekOfYear.Jan1) % 12);
    // Dim day As Integer = DateDiff(DateInterval.Day, DateTimePicker1.Value, Now) Mod 30 - 10
    TextBox1.Text = yr.ToString() + " Years, " + month.ToString() + " Months ";
    }
    }

    }

    ReplyDelete
    Replies
    1. i found no DateAndTime.DateDiff(Dateinterval.year build in function, nor it is acceptable. give some correct if possible

      Delete
  2. Students Must Try This Code in Visual Studio For Age Calculator. And Enjoy With Output.

    ReplyDelete