Sponsored Links


Results 1 to 1 of 1

Thread: cs304 first may spring semester for mcs 2015 final solution

  1. #1
    Administrator Xpert's Avatar
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    6,217

    cs304 first may spring semester for mcs 2015 final solution

    Sponsored Links


    Solution for cs304 first may spring semester of virtual university of Pakistan 2015

    • To give you the idea of practical implementation of class with attributes and functions

    Problem Statement:

    Consider the following attributes and functions of the class Time:
    Attributes:


    • int hour
    • int minute
    • int seconds

    Functions:

    • void setTime(int, int, int);
    • void show12Hour();
    • void show24Hour();


    Write a program to instantiate the object of a class Time from the main() function and constructor is called of the class Time automatically to initialize the private data members of the class with 0. Time is printed on the screen in 12 hours format and 24 hours format as follows:

    Initial Time:

    Time display in 12 hours format: 12:00:00 AM
    Time display in 24 hours format: 00:00

    After that use the setTime() function to set the time by passing the 3 attributes of time i.e setTime(13,55,23) and show the time again after setting:

    After set:

    Time display in 12 hours format: 01:55:23 PM
    Time display in 24 hours format: 13:55

    Now try to use setTime() function for setting invalid values i.e setTime(25,67,98) . Your program should not set invalid values of time and show finally the time as initial.

    Time display in 12 hours format: 12:00:00 AM
    Time display in 24 hours format: 00:00




    Sponsored Links


    Sample Output:
    Attached Images Attached Images

  2. Sponsored Links

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 07-13-2013, 06:56 PM
  2. Replies: 0
    Last Post: 06-18-2013, 09:44 PM
  3. Replies: 0
    Last Post: 05-17-2013, 04:29 PM
  4. Replies: 1
    Last Post: 04-27-2013, 04:15 PM
  5. Replies: 0
    Last Post: 02-11-2013, 04:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft